mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-04-20 04:56:55 +02:00
46 lines
1.1 KiB
Bash
Executable file
46 lines
1.1 KiB
Bash
Executable file
#!/sbin/openrc-run
|
|
# 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
|
|
after firewall
|
|
provide dns
|
|
}
|
|
|
|
#-----------------------------------------------------------------
|
|
# Main program
|
|
|
|
start() {
|
|
UID=$(id -u dnscache)
|
|
GID=$(id -g dnscache)
|
|
|
|
ebegin "Starting dnscache"
|
|
if [ -z "$UID" ] || [ -z "$GID" ]; then
|
|
eend 1 "dnscache user or group missing"
|
|
return 1
|
|
fi
|
|
|
|
OPTS=""
|
|
[ "$FORWARDONLY" ] && OPTS="$OPTS --env FORWARDONLY=$FORWARDONLY"
|
|
[ "$HIDETTL" ] && OPTS="$OPTS --env HIDETTL=$HIDETTL"
|
|
[ "$CACHESIZE" ] && OPTS="$OPTS --env CACHESIZE=$CACHESIZE"
|
|
|
|
start-stop-daemon --start --env "UID=$UID" --env "GID=$GID" \
|
|
--env "ROOT=$ROOT" --env "IP=$IP" --env "IPSEND=$IPSEND" \
|
|
$OPTS --pidfile $PIDFILE \
|
|
--background --make-pidfile --exec $DAEMON -- < /dev/urandom
|
|
eend $?
|
|
}
|
|
|
|
stop() {
|
|
ebegin "Stopping dnscache"
|
|
start-stop-daemon --stop --pidfile $PIDFILE --exec $DAEMON
|
|
eend $?
|
|
}
|
|
|