Starting processes automatically at boot-up



  1. Add a script to start the program in /sbin/init.d. Use /sbin/init.d/skeleton as an example. Remove `startproc' if program is not a daemon.
  2. Make script executable, i.e. rwxr--r--.
  3. Find out what runlevel you are at by typing "runlevel".
  4. cd to /sbin/init.d/rc2.d (for example, if runlevel was 2).
  5. Make a soft link:
    ln -s ../myscript S23local 
    This will run your script with the argument "start" whenever the system goes to runlevel 2 and again with the argument "stop" when the system leaves runlevel 2.
  6. The number (23 in this example) indicates the order in which the script is executed in relation to all the other scripts. However, they are not run in numeric order but in ASCII sort order, so for example S10stuff will be run before S9stuff. Leading zeros (e.g., S09stuff) are needed to get them to run in numerical order.
  7. Also, everything in this directory should be a link and not a file. If you also make a link
    ln -s ../myscript K23local
    it will run your script with the argument "stop" whenever the system leaves runlevel 2. This is optional.
  8. Make sure everything is working by typing
     rctab -l 
    (lower-case L) This shows the order in which the scripts will be run for each runlevel. In most cases runlevel 3 is the same as 2, except for xdm, so a similar link should probably also be placed in /sbin/init.d/rc3.d.

Back