integ/base/dnsmasq/files/init
Scott Little db9aaf09da Relocate dnsmasq to stx-integ/base/dnsmasq
Move content from stx-gplv3 into stx-integ

Packages will be relocated to

stx-integ:
    base/
        anaconda
        crontabs
        dnsmasq
        rsync

    database/
        python-psycopg2

    filesystem/
        parted

    grub/
        grub2

    security/
        python-keyring

Change-Id: I357310173e6bd1a1005e76be619a5ff5c9bcbed4
Story: 2002801
Task: 22687
Signed-off-by: Scott Little <scott.little@windriver.com>
2018-08-01 15:39:09 -04:00

60 lines
1.2 KiB
Bash

#!/bin/sh
if [ -f /etc/centos-release ]; then
DAEMON=/usr/sbin/dnsmasq
else
DAEMON=/usr/bin/dnsmasq
fi
NAME=dnsmasq
DESC="DNS forwarder and DHCP server"
PIDFILE="/var/run/dnsmasq.pid"
test -f $DAEMON || exit 0
case "$1" in
start)
echo -n "starting $DESC: $NAME... "
test -d /var/lib/misc/ || mkdir /var/lib/misc/
start-stop-daemon -S -x $DAEMON --pidfile $PIDFILE -- $ARGS
echo "done."
echo -n "Refresh hosts cache"
nscd -i hosts
echo "done."
;;
stop)
echo -n "stopping $DESC: $NAME... "
start-stop-daemon -K -x $DAEMON --pidfile $PIDFILE
rm -f $PIDFILE
echo "done."
;;
status)
echo -n "dnsmasq "
start-stop-daemon -q -K -t -x $DAEMON --pidfile $PIDFILE
RET=$?
if [ "$RET" = "0" ]; then
PID=`cat $PIDFILE`
echo "($PID) is running"
else
echo "is not running"
# For lsb compliance return 3 if process not running
exit 3
fi
;;
restart)
echo "restarting $DESC: $NAME... "
$0 stop
$0 start
echo "done."
;;
reload)
echo -n "reloading $DESC: $NAME... "
killall -HUP $(basename ${DAEMON})
echo "done."
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload}"
exit 1
;;
esac
exit 0