The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Things look quiet here. But I've been doing a lot of blogging at dan.langille.org because I prefer WordPress now. Not all my posts there are FreeBSD related. I am in the midst of migrating The FreeBSD Diary over to WordPress (and you can read about that here). Once the migration is completed, I'll move the FreeBSD posts into the new FreeBSD Diary website.

how to start things at boot time 5 December 1999
Need more help on this topic? Click here
This article has 1 comment
Show me similar articles
See 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 friend
The /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
/etc/rc.local was your friend
At one time, /etc/rc.local was the file into which you placed calls to the various start up scripts.  This feature remains for backwards compatibility but it has been deprecated.  Use /usr/local/etc/rc.d/ instead.

Share
Need more help on this topic? Click here
This article has 1 comment
Show me similar articles