View Full Version : [kubuntu] How to Autostart a script as a program?

March 7th, 2011, 12:42 PM
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.

March 7th, 2011, 01:13 PM
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.

March 7th, 2011, 01:38 PM
I add: #! bin/sh -e at the first of the code
Try this instead:

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.

March 7th, 2011, 03:11 PM
Thank you all It works. But the problem in my script.

Excuse me, what is the different between:



#!/bin/sh -e

March 7th, 2011, 03:50 PM
/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:

The -e option has the script exit when an error happens: