Created
January 22, 2016 15:56
-
-
Save EkkoG/b1356b009c887ce22de4 to your computer and use it in GitHub Desktop.
pdnsd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh /etc/rc.common | |
START=65 | |
NAME=pdnsd | |
DESC="proxy DNS server" | |
PDNSD_LOCAL_PORT=7453 | |
DAEMON=/usr/sbin/pdnsd | |
PID_FILE=/var/run/$NAME.pid | |
CACHEDIR=/var/pdnsd | |
CACHE=$CACHEDIR/pdnsd.cache | |
USER=nobody | |
GROUP=nogroup | |
start() { | |
gen_cache | |
start_pdnsd | |
} | |
stop() { | |
kill `cat $PID_FILE` > /dev/null 2>&1 | |
rm -rf $PID_FILE | |
rm -rf /var/pdnsd/ | |
} | |
restart() { | |
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 | |
} | |
start_pdnsd() { | |
cat > /etc/pdnsd.conf <<EOF | |
global { | |
perm_cache=2048; | |
cache_dir="/var/pdnsd"; | |
pid_file = /var/run/pdnsd.pid; | |
run_as="nobody"; | |
server_ip = 127.0.0.1; | |
server_port = $PDNSD_LOCAL_PORT; | |
status_ctl = on; | |
query_method = udp_tcp; | |
min_ttl=1d; | |
max_ttl=1w; | |
timeout=10; | |
neg_domain_pol=on; | |
proc_limit=2; | |
procq_limit=8; | |
} | |
server { | |
label= "dns"; | |
ip = 127.0.0.1; | |
port = 1053; | |
timeout=6; | |
uptest=none; | |
interval=10m; | |
purge_cache=off; | |
} | |
EOF | |
$DAEMON -d -p $PID_FILE | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment