source: trunk/packages/invirt-dhcp/debian/invirt-dhcp.init @ 2800

Last change on this file since 2800 was 1432, checked in by broder, 16 years ago

Use a library init script in invirt-dhcp

File size: 1.4 KB
RevLine 
[273]1#! /bin/sh
2### BEGIN INIT INFO
[1430]3# Provides:          invirt-dhcp
[273]4# Required-Start:    $local_fs $remote_fs
5# Required-Stop:     $local_fs $remote_fs
6# Default-Start:     2 3 4 5
7# Default-Stop:      0 1 6
[1430]8# Short-Description: invirt DHCP server
[273]9# Description:       
10### END INIT INFO
11
[1430]12# Author: Invirt project <invirt@mit.edu>
[273]13
14# Do NOT "set -e"
15
16# PATH should only include /usr/* if it runs after the mountnfs.sh script
17PATH=/sbin:/usr/sbin:/bin:/usr/bin
[1430]18DESC="The Invirt DHCP server"
19NAME=invirt-dhcp
20DAEMON=/usr/sbin/invirt-dhcpserver
[273]21DAEMON_ARGS=""
22PIDFILE=/var/run/$NAME.pid
23SCRIPTNAME=/etc/init.d/$NAME
24
25# Exit if the package is not installed
26[ -x "$DAEMON" ] || exit 0
27
[1432]28. /lib/init/std-init.sh
[273]29
30#
31# Function that starts the daemon/service
32#
33do_start()
34{
35        # Return
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
[1430]40        daemon -r -O daemon.info -E daemon.err -n $NAME -U $DAEMON $DAEMON_ARGS || return 2
[273]41}
42
43#
44# Function that stops the daemon/service
45#
46do_stop()
47{
48        # Return
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
54        RETVAL="$?"
55        [ "$RETVAL" = 2 ] && return 2
56        # Many daemons don't delete their pidfiles when they exit.
57        rm -f $PIDFILE
58        return "$RETVAL"
59}
60
[1432]61std_init "$1"
Note: See TracBrowser for help on using the repository browser.