how to start things at boot timeSee also Starting stuff at boot time.
This article talks about how to get scripts to execute each time the box is rebooted. This is handy for ensuring certain programs are always running.
[Note: the original article title was "/etc/autoexec.bat | how to start things at boot time". This was discarded because the humour assumed a familiarity with DOS.]
/usr/local/etc/rc.d/ is your friendThe /usr/local/etc/rc.d/ directory is one of the default startup directories. If you look at /etc/defaults/rc.conf, you’ll find this:
# grep local_start /etc/defaults/rc.conf local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d"
This setting determines which directories are scanned for shell scripts at startup. Executable files within these directories are run in alphabetical order. If you need the files to be executed in a specific order, try numbering the files. For example:
000This.Will.Run.First.sh 020This.Will.Run.Next.sh 030And.Then.This.sh