IM-07: How do I start programs at boot?
The simplest way is to add a line at the end of /etc/rc.local to call your script/executable. I have a similar entry like this at my rc.local to try and delete unused files in my /tmp partition and to start the distributed.net client everytime I boot my machine.
CODE
su - ramfree17 -c "/path/to/dnetc -quiet"
tmpwatch -fa 120 /tmp
tmpwatch -fa 120 /tmp
You could also start your program by putting it in the /etc/inittab to make sure that it is restarted again when killed. The entry
CODE
r1:2345:respawn:/run/your/script
will start your process on runlevel 2-5 and make sure that it is restarted even if you kill the process (usually after 5 seconds).Another approach to take is to create your own startup scripts that can be placed in /etc/init.d/. You can pattern your script from one of the existing scripts in the directory and after that you can start/stop your script using:
CODE
# /etc/init.d/myscript start
# /etc/init.d/myscript stop
# /etc/init.d/myscript stop
When your script is functioning propely, you can use chkconfig to make it automatically run at particular runlevels.
Reference Link(s):
man su
man chkconfig
<TODO> Provide an example of a script that could be placed in /etc/init.d </TODO>