openwrt_archive/net/pdnsd/files/pdnsd.init
Florian Fainelli 01d1951058 [package] add pdnsd DNS proxy
pdnsd, is an IPv6 capable proxy DNS server with permanent caching (the cache
contents are written to hard disk on exit) that is designed to cope with
unreachable or down DNS servers (for example in dial-in networking).

pdnsd can be used with applications that do dns lookups, eg on startup, and
can't be configured to change that behaviour, to prevent the often
minute-long hangs (or even crashes) that result from stalled dns queries.

Signed-off-by: Sebastian Muszynski <basti@linkt.de>

SVN-Revision: 33173
2012-08-13 14:08:47 +00:00

47 lines
824 B
Bash

#!/bin/sh /etc/rc.common
START=65
NAME=pdnsd
DESC="proxy DNS server"
DAEMON=/usr/sbin/pdnsd
PID_FILE=/var/run/$NAME.pid
CACHEDIR=/var/pdnsd
CACHE=$CACHEDIR/pdnsd.cache
USER=nobody
GROUP=nogroup
start() {
echo -n "Starting $DESC: $NAME"
gen_cache
$DAEMON --daemon -p $PID_FILE
echo " ."
}
stop() {
echo -n "Stopping $DESC: $NAME"
kill `cat $PID_FILE` > /dev/null 2>&1
rm -rf $PID_FILE
echo " ."
}
restart() {
echo "Restarting $DESC: $NAME... "
stop
sleep 2
start
}
gen_cache()
{
if ! test -f "$CACHE"; then
mkdir -p `dirname $CACHE`
dd if=/dev/zero of="$CACHE" bs=1 count=4 2> /dev/null
chown -R $USER.$GROUP $CACHEDIR
fi
}