Where Do I Put Startup Commands In Debian? 

http://www.justlinux.com/nhf/Distribution_Specific/Debian_GNULinux/Debian__Startup_Commands.html

Craig McPherson

The question is "What's the Debian equivalent of rc.local" or "Where can I put startup commands in Debian?"

  1. Create your rc.local file like this (as root):

    touch /etc/init.d/rc.local
    chmod 774 /etc/init.d/rc.local
  2. Set it to be run at boot time by doing this:

    update-rc.d -f rc.local start 99 2 3 4 5 .
  3. Edit your /etc/init.d/rc.local script.

This assumes you want to run your script in runlevels 2, 3, 4, and 5. If you only want to run it in say, runlevel 3, remove the 2, 4, and 5. Don't forget the period at the end. This also assumes you want to run it last (99) during the bootup process. This is generally what you want to do, to make sure your network connection is up and all the basic services are started before your custom startup script runs. Use a value smaller than 99 if you want it run sooner.

If you want your script to ALWAYS be run, no matter what runlevel you boot into, even in Single User Mode (runlevel 1), make your symlink in /etc/rcS.d instead of /etc/rcX.d.

If for some reason you have commands you need to run sometime eariler in the bootup process, you can create multiple scripts this way. It doesn't matter what you name them, just stick them in /etc/init.d, then use update-rc.d to put symlink in /etc/rcX.d.