3 # Provides: invirt-dhcp
4 # Required-Start: $local_fs $remote_fs
5 # Required-Stop: $local_fs $remote_fs
6 # Default-Start: 2 3 4 5
8 # Short-Description: invirt DHCP server
12 # Author: Invirt project <invirt@mit.edu>
16 # PATH should only include /usr/* if it runs after the mountnfs.sh script
17 PATH=/sbin:/usr/sbin:/bin:/usr/bin
18 DESC="The Invirt DHCP server"
20 DAEMON=/usr/sbin/invirt-dhcpserver
22 PIDFILE=/var/run/$NAME.pid
23 SCRIPTNAME=/etc/init.d/$NAME
25 # Exit if the package is not installed
26 [ -x "$DAEMON" ] || exit 0
28 . /lib/init/std-init.sh
31 # Function that starts the daemon/service
36 # 0 if daemon has been started
37 # 1 if daemon was already running
38 # 2 if daemon could not be started
39 daemon --running -n $NAME && return 1
40 daemon -r -O daemon.info -E daemon.err -n $NAME -U $DAEMON $DAEMON_ARGS || return 2
44 # Function that stops the daemon/service
49 # 0 if daemon has been stopped
50 # 1 if daemon was already stopped
51 # 2 if daemon could not be stopped
52 # other if a failure occurred
53 daemon --stop -n $NAME
55 [ "$RETVAL" = 2 ] && return 2
56 # Many daemons don't delete their pidfiles when they exit.