Results 1 to 5 of 5

Thread: How to Autostart a script as a program?

  1. #1
    Join Date
    Dec 2010
    Beans
    18

    Arrow How to Autostart a script as a program?

    How can I make a script file a runnable thread auto-start program, please?
    the script is: executable permission
    I add: #! bin/sh -e at the first of the code
    I add /home/sok/Scripts/check.sh at the end of /etc/rc.local before exit 0
    I add /home/sok/Scripts/check.sh in Autostart as aprogram.

    I restart the system.
    no effect. Is there something missing, please in need to help??


    Interested Linux beginner.

  2. #2
    Join Date
    Dec 2010
    Location
    London
    Beans
    73
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: How to Autostart a script as a program?

    When do you want this script to be executed ? Only when you start the PC or every 2/3 hours as repeated program ?

    If it is only once, follow these steps.

    make sure you have given execute options for the .sh file.

    I assume that you are using Ubuntu, then follow this.

    Go to Global menu --> System --> Preferences --> Startup Applications.

    Make a new entry and select this file.

    Restart the machine and see if that works.

  3. #3
    Join Date
    Nov 2009
    Beans
    1,879
    Distro
    Ubuntu Studio 9.10 Karmic Koala

    Re: How to Autostart a script as a program?

    I add: #! bin/sh -e at the first of the code
    Try this instead:
    Code:
    #!/bin/bash
    Then you will need to right click, properties, and allow it to run as a program. Check it runs first before adding it to autostart.

  4. #4
    Join Date
    Dec 2010
    Beans
    18

    Re: How to Autostart a script as a program?

    Thank you all It works. But the problem in my script.

    Excuse me, what is the different between:
    Code:
    #!/bin/bash
    Code:
    #!/bin/sh
    Code:
    #!/bin/sh -e
    Last edited by MODYSAMA; March 7th, 2011 at 03:13 PM.

  5. #5
    Join Date
    Nov 2009
    Beans
    1,879
    Distro
    Ubuntu Studio 9.10 Karmic Koala

    Re: How to Autostart a script as a program?

    /bin/bash is just what I always use as it is the same as what you get in a terminal. See here for the difference:
    http://www.linuxquestions.org/questi...bin-sh-693231/

    The -e option has the script exit when an error happens:
    http://etbe.coker.com.au/2009/11/20/...stroy-your-os/

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •