wok rev 3885

dnsmasq: add init script
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Aug 12 12:50:40 2009 +0200 (2009-08-12)
parents 9028b16098a8
children 55bfd8c4ab85
files dnsmasq/receipt dnsmasq/stuff/etc/init.d/dnsmasq
line diff
     1.1 --- a/dnsmasq/receipt	Wed Aug 12 09:39:16 2009 +0000
     1.2 +++ b/dnsmasq/receipt	Wed Aug 12 12:50:40 2009 +0200
     1.3 @@ -23,5 +23,6 @@
     1.4  {
     1.5  	mkdir -p $fs/usr
     1.6  	cp -a $_pkg/usr/sbin $fs/usr
     1.7 +	cp -a stuff/* $fs
     1.8  }
     1.9  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/dnsmasq/stuff/etc/init.d/dnsmasq	Wed Aug 12 12:50:40 2009 +0200
     2.3 @@ -0,0 +1,57 @@
     2.4 +#!/bin/sh
     2.5 +# /etc/init.d/dnsmasq: Start, stop and restart Rsync deamon on SliTaz, at boot
     2.6 +# time or with the command line.
     2.7 +#
     2.8 +# To start daemon at boot time, just put the right name in the $RUN_DAEMONS
     2.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
    2.10 +#
    2.11 +. /etc/init.d/rc.functions
    2.12 +. /etc/daemons.conf
    2.13 +
    2.14 +NAME=DNSmasq
    2.15 +DESC="dnsmasq deamon"
    2.16 +DAEMON=/usr/sbin/dnsmasq
    2.17 +OPTIONS=$DNSMASQ_OPTIONS
    2.18 +PIDFILE=/var/run/dnsmasq.pid
    2.19 +
    2.20 +case "$1" in
    2.21 +  start)
    2.22 +    if active_pidfile $PIDFILE dnsmasq ; then
    2.23 +      echo "$NAME already running."
    2.24 +      exit 1
    2.25 +    fi
    2.26 +    echo -n "Starting $DESC: $NAME... "
    2.27 +    $DAEMON $OPTIONS 
    2.28 +    status
    2.29 +    ;;
    2.30 +  stop)
    2.31 +    if ! active_pidfile $PIDFILE dnsmasq ; then
    2.32 +      echo "$NAME is not running."
    2.33 +      exit 1
    2.34 +    fi
    2.35 +    echo -n "Stopping $DESC: $NAME... "
    2.36 +    kill `cat $PIDFILE`
    2.37 +    rm $PIDFILE
    2.38 +    status
    2.39 +    ;;
    2.40 +  restart)
    2.41 +    if ! active_pidfile $PIDFILE dnsmasq ; then
    2.42 +      echo "$NAME is not running."
    2.43 +      exit 1
    2.44 +    fi
    2.45 +    echo -n "Restarting $DESC: $NAME... "
    2.46 +    kill `cat $PIDFILE`
    2.47 +    rm $PIDFILE
    2.48 +    sleep 2
    2.49 +    $DAEMON $OPTIONS
    2.50 +    status
    2.51 +    ;;
    2.52 +  *)
    2.53 +    echo ""
    2.54 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    2.55 +    echo ""
    2.56 +    exit 1
    2.57 +    ;;
    2.58 +esac
    2.59 +
    2.60 +exit 0