#!/sbin/runscript # control n instances of dnscache, without daemontools # written for alpine linux - NBA April 2007 # -- Statrup variables ROOT=/etc/dnscache DAEMON=/usr/bin/dnscache PIDFILE=/var/run/dnscache.pid depend() { need net provide dns } #----------------------------------------------------------------- # Main program start() { UID=$( grep dnscache /etc/passwd | cut -f3 -d: ) GID=$( grep dnscache /etc/group | cut -f3 -d: ) ebegin "Starting dnscache" if [ -z "$UID" ] || [ -z "$GID" ]; then eend 1 "dnscache user or group missing" return 1 fi start-stop-daemon --start --env "UID=$UID" --env "GID=$GID" \ --env "ROOT=$ROOT" --env "IP=$IP" --env "IPSEND=$IPSEND" \ --env "HIDETTL=$HIDETTL" --env "CACHESIZE=$CACHESIZE" \ --env "FORWARDONLY=$FORWARDONLY" --pidfile $PIDFILE \ --background --make-pidfile --exec $DAEMON -- < /dev/urandom eend $? } stop() { ebegin "Stopping dnscache" start-stop-daemon --stop --pidfile $PIDFILE --exec $DAEMON eend $? }