View Full Version : How do I make a program start when linux does?
Jrdgames
19th January 2007, 06:21
How do I make a program start with linux? Or can I?
OS is in signature.
-JRD
martinfst
19th January 2007, 09:56
In the directory /etc you'll find a bunch of sub directories starting with rc. The numbers represent the so called run level. Default runlevel may vary per Linux variant. There's also a /etc/rc.local file, that's where I add my local commands, if you need it executed for all run levels.
E.g. runlevel 1 is single user mode, no network, no mounted filesystems, only console. Sort of emergency level. Nowadays nobody cares much about the runlevels, everything is started. In the rc<0-6>.d directories, there are README files with more info.
sjau
19th January 2007, 10:01
well, if you are using a gui environment then you can add programs to autostart in gnome/kde/xfce... or you can save a session which will be restored upon reboot...
If you don't have a gui - so if you're just using it as server - you'll need to add the program to the according runlevels.
falko
20th January 2007, 19:12
On Ubuntu you must make sure that the init script of your program is in /etc/init.d, and that it is executable. Then you simply run
update-rc.d name_of_script defaults
martinfst
20th January 2007, 20:38
Now that's a trick I didn't know. Thanks for this pointer so I don't have to create all those stupid links myself anymore. I abused rc.local normally because I'm too lazy to do all the typing :p
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.