pavement

Usr/local/etc/rc.d

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
(no extension is necessary in order for the scripts to execute)
Line 1: Line 1:
'''/usr/local/etc/rc.d''' isn't actually a config file, it's a directory.  Any executable shell script ending in .sh in this directory will be executed (using the bourne shell) with the argument "start" when the system boots, and again with the argument "stop" when the system is shut down.
+
'''/usr/local/etc/rc.d''' isn't actually a config file, it's a directory.  Any executable shell script in this directory will be executed (using the [[Bourne shell]]) with the argument "start" when the system boots, and again with the argument "stop" when the system is shut down.
 +
 
 +
 
  
 
You may find this generic rc.d script (shown as I use it to start bind9) handy for general purpose use:
 
You may find this generic rc.d script (shown as I use it to start bind9) handy for general purpose use:

Revision as of 15:14, 1 May 2006

/usr/local/etc/rc.d isn't actually a config file, it's a directory. Any executable shell script in this directory will be executed (using the Bourne shell) with the argument "start" when the system boots, and again with the argument "stop" when the system is shut down.


You may find this generic rc.d script (shown as I use it to start bind9) handy for general purpose use:

#!/bin/sh

case "$1" in
start)
        /usr/sbin/named -c /etc/namedb/named.conf &
        echo "bind9"
        exit 0
        ;;
stop)
        exec killall named
        ;;
*)
        echo "Usage: `basename $0` {start|stop}" >&2
        exit 64
        ;;
esac

Note that scripts in /usr/local/etc/rc.d cannot and will not execute, at boot time or otherwise, if you do not set the permissions to allow their execution. In most cases, you will want to chmod 755 any rc.d scripts, though you may also consider 700 on root-owned rc.d scripts to make sure that unprivileged users don't mess with attempting to start or stop sensitive services.

Personal tools