# HG changeset patch # User Pascal Bellard # Date 1250074240 -7200 # Node ID b7e5667bff3707d01c3a6b15301309800f3c0b4f # Parent 9028b16098a885e0f9a86c2eb6c46a2139e57890 dnsmasq: add init script diff -r 9028b16098a8 -r b7e5667bff37 dnsmasq/receipt --- a/dnsmasq/receipt Wed Aug 12 09:39:16 2009 +0000 +++ b/dnsmasq/receipt Wed Aug 12 12:50:40 2009 +0200 @@ -23,5 +23,6 @@ { mkdir -p $fs/usr cp -a $_pkg/usr/sbin $fs/usr + cp -a stuff/* $fs } diff -r 9028b16098a8 -r b7e5667bff37 dnsmasq/stuff/etc/init.d/dnsmasq --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dnsmasq/stuff/etc/init.d/dnsmasq Wed Aug 12 12:50:40 2009 +0200 @@ -0,0 +1,57 @@ +#!/bin/sh +# /etc/init.d/dnsmasq: Start, stop and restart Rsync deamon on SliTaz, at boot +# time or with the command line. +# +# To start daemon at boot time, just put the right name in the $RUN_DAEMONS +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf. +# +. /etc/init.d/rc.functions +. /etc/daemons.conf + +NAME=DNSmasq +DESC="dnsmasq deamon" +DAEMON=/usr/sbin/dnsmasq +OPTIONS=$DNSMASQ_OPTIONS +PIDFILE=/var/run/dnsmasq.pid + +case "$1" in + start) + if active_pidfile $PIDFILE dnsmasq ; then + echo "$NAME already running." + exit 1 + fi + echo -n "Starting $DESC: $NAME... " + $DAEMON $OPTIONS + status + ;; + stop) + if ! active_pidfile $PIDFILE dnsmasq ; then + echo "$NAME is not running." + exit 1 + fi + echo -n "Stopping $DESC: $NAME... " + kill `cat $PIDFILE` + rm $PIDFILE + status + ;; + restart) + if ! active_pidfile $PIDFILE dnsmasq ; then + echo "$NAME is not running." + exit 1 + fi + echo -n "Restarting $DESC: $NAME... " + kill `cat $PIDFILE` + rm $PIDFILE + sleep 2 + $DAEMON $OPTIONS + status + ;; + *) + echo "" + echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" + echo "" + exit 1 + ;; +esac + +exit 0