DJBDNS logging init.d

From Noah.org
Jump to: navigation, search

Some deviant installs of DJBDNS use /etc/init.d to start and stop the server. I can understand why this is done, but in one case this left me without logging. This is one that I found, but it was setup without multilog, so I had to shoehorn it back in.

# cat /etc/init.d/tinydns
#!/bin/sh
#
# tinydns      Authoritative DNS server
#
# chkconfig: 345 11 89
# description: Dan Bernstein (DJB) authoritative dns server
#

# See how we were called.
case "$1" in
  start)

        echo -n "Starting: "
        env - PATH="/var/qmail/bin:/usr/local/bin" IP=192.168.2.226 \
        ROOT=/var/tinydns/root envuidgid tinydns softlimit -d300000 \
        /usr/local/bin/tinydns 2>&1 | /usr/local/bin/multilog t /var/tinydns/log/226 &
#       ROOT=/var/tinydns/root envuidgid tinydns softlimit -d300000 \
#        /usr/local/bin/tinydns 2> /dev/null &
    env - PATH="/var/qmail/bin:/usr/local/bin" IP=192.168.2.227 \
    ROOT=/var/tinydns/root envuidgid tinydns softlimit -d300000 \
        /usr/local/bin/tinydns 2>&1 | /usr/local/bin/multilog t /var/tinydns/log/227 &
#    ROOT=/var/tinydns/root envuidgid tinydns softlimit -d300000 \
#        /usr/local/bin/tinydns 2> /dev/null &

        echo "tinydns"
        ;;
  stop)
        killall tinydns
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage: tinydns {start|stop|restart}"
        exit 1
esac

exit 0