wok annotate dnsmasq/stuff/etc/init.d/dnsmasq @ rev 20700
updated afio (2.5.1 -> 2.5.2)
author | Hans-G?nter Theisgen |
---|---|
date | Tue Feb 05 17:01:36 2019 +0100 (2019-02-05) |
parents | 7f188676b59c |
children | 24fe92acc96d |
rev | line source |
---|---|
pascal@3885 | 1 #!/bin/sh |
al@19161 | 2 # /etc/init.d/dnsmasq: Start, stop and restart DNSmasq daemon on SliTaz, at boot |
pascal@3885 | 3 # time or with the command line. |
pascal@3885 | 4 # |
pascal@3885 | 5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS |
pascal@3885 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf. |
pascal@3885 | 7 # |
pascal@3885 | 8 . /etc/init.d/rc.functions |
pascal@3885 | 9 . /etc/daemons.conf |
pascal@3885 | 10 |
pascal@3885 | 11 NAME=DNSmasq |
al@19159 | 12 DESC="$(_ '%s daemon' dnsmasq)" |
pascal@3885 | 13 DAEMON=/usr/sbin/dnsmasq |
pascal@3885 | 14 OPTIONS=$DNSMASQ_OPTIONS |
pascal@3885 | 15 PIDFILE=/var/run/dnsmasq.pid |
pascal@3885 | 16 |
pascal@3885 | 17 case "$1" in |
pascal@3885 | 18 start) |
pascal@3885 | 19 if active_pidfile $PIDFILE dnsmasq ; then |
al@19159 | 20 _ '%s is already running.' $NAME |
pascal@3885 | 21 exit 1 |
pascal@3885 | 22 fi |
al@19159 | 23 action 'Starting %s: %s...' "$DESC" $NAME |
al@19159 | 24 $DAEMON $OPTIONS |
pascal@3885 | 25 status |
pascal@3885 | 26 ;; |
pascal@3885 | 27 stop) |
pascal@3885 | 28 if ! active_pidfile $PIDFILE dnsmasq ; then |
al@19159 | 29 _ '%s is not running.' $NAME |
pascal@3885 | 30 exit 1 |
pascal@3885 | 31 fi |
al@19159 | 32 action 'Stopping %s: %s...' "$DESC" $NAME |
al@19159 | 33 kill $(cat $PIDFILE) |
pascal@3885 | 34 rm $PIDFILE |
pascal@3885 | 35 status |
pascal@3885 | 36 ;; |
pascal@3885 | 37 restart) |
pascal@3885 | 38 if ! active_pidfile $PIDFILE dnsmasq ; then |
al@19159 | 39 _ '%s is not running.' $NAME |
pascal@3885 | 40 exit 1 |
pascal@3885 | 41 fi |
al@19159 | 42 action 'Restarting %s: %s...' "$DESC" $NAME |
al@19159 | 43 kill $(cat $PIDFILE) |
pascal@3885 | 44 rm $PIDFILE |
pascal@3885 | 45 sleep 2 |
pascal@3885 | 46 $DAEMON $OPTIONS |
pascal@3885 | 47 status |
pascal@3885 | 48 ;; |
pascal@3885 | 49 *) |
al@19159 | 50 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" |
al@19159 | 51 newline |
pascal@3885 | 52 exit 1 |
pascal@3885 | 53 ;; |
pascal@3885 | 54 esac |
pascal@3885 | 55 |
pascal@3885 | 56 exit 0 |