Ignore:
Timestamp:
Feb 24, 2008, 10:34:49 PM (16 years ago)
Author:
broder
Message:

Created init scripts and moved dnsserver.py script into sipb-xen-dns package

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-dns/debian/sipb-xen-dns.init

    r268 r269  
    1919# PATH should only include /usr/* if it runs after the mountnfs.sh script
    2020PATH=/sbin:/usr/sbin:/bin:/usr/bin
    21 DESC="Description of the service"
    22 NAME=daemonexecutablename
    23 DAEMON=/usr/sbin/$NAME
    24 DAEMON_ARGS="--options args"
     21DESC="The sipb-xen DNS server"
     22NAME=sipb-xen-dns
     23DAEMON=/usr/local/lib/sipb-xen-dns/dnsserver.py
     24DAEMON_ARGS=""
    2525PIDFILE=/var/run/$NAME.pid
    2626SCRIPTNAME=/etc/init.d/$NAME
     
    4848        #   1 if daemon was already running
    4949        #   2 if daemon could not be started
    50         start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
    51                 || return 1
    52         start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
    53                 $DAEMON_ARGS \
    54                 || return 2
    55         # Add code here, if necessary, that waits for the process to be ready
    56         # to handle requests from services started subsequently which depend
    57         # on this one.  As a last resort, sleep for some time.
     50        daemon --running -n $NAME && return 1
     51        daemon -r -n $NAME -U $DAEMON $DAEMON_ARGS || return 2
    5852}
    5953
     
    6862        #   2 if daemon could not be stopped
    6963        #   other if a failure occurred
    70         start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
     64        daemon --stop -n $NAME
    7165        RETVAL="$?"
    7266        [ "$RETVAL" = 2 ] && return 2
    73         # Wait for children to finish too if this is a daemon that forks
    74         # and if the daemon is only ever run from this initscript.
    75         # If the above conditions are not satisfied then add some other code
    76         # that waits for the process to drop all resources that could be
    77         # needed by services started subsequently.  A last resort is to
    78         # sleep for some time.
    79         start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
    80         [ "$?" = 2 ] && return 2
    8167        # Many daemons don't delete their pidfiles when they exit.
    8268        rm -f $PIDFILE
    8369        return "$RETVAL"
    84 }
    85 
    86 #
    87 # Function that sends a SIGHUP to the daemon/service
    88 #
    89 do_reload() {
    90         #
    91         # If the daemon can reload its configuration without
    92         # restarting (for example, when it is sent a SIGHUP),
    93         # then implement that here.
    94         #
    95         start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
    96         return 0
    9770}
    9871
Note: See TracChangeset for help on using the changeset viewer.