Run an application at startup


I want to start an application at startup, independently of which user logs in. I know I should configure this in the runlevels, but I just don’t remember how to do this, or whether there’s an easier way. Thanks.

Put the command in the file /etc/init.d/boot.local

Swerdnas advice is sound (as allways) and it is by far the easyest way of doing it. But boot.local is run very early in the boot sequence. The network will not run at that moment. So when your app needs the network you must go for a more difficult way.

In that case take a look at /etc/init.d/skeleton. Make a copy of it in /etc/init.d/ with the name of your app. Edit it in the proper places te see that it does start/stop what you want. Also see that the correct runlevel is configured there (when you want it to run with running network start it on runlevel 3 and above, when it should run only when the GUI is started use runlevel 5).

After this you can start/stop your app in different ways, but the most easy way is to use YaST > System > System Services (Runlevel). When you did the adaption of the skeleton correct, you will find your app in the list and can activate it from there. YaST wiill then start it and register it for starting at every boot.

Would it be easier to put the command in a root cron job with a 10 second sleep before it, set to go at boot time?
Cron line:

@reboot sleep 10;command_you_want

Inelegant but effective (& maybe even a bit elegant).

I just read the man page for this. Seems to be an Extension. I suppose it is not in POSIX. But never mind, when you do not want to port this to another Unix, it may serve you for years to come lol!