diff options
author | dm <dm@cvs.openbsd.org> | 1996-02-19 19:54:44 +0000 |
---|---|---|
committer | dm <dm@cvs.openbsd.org> | 1996-02-19 19:54:44 +0000 |
commit | 34dfcd3c571a64de57872aa758d1b228d7b22a02 (patch) | |
tree | 22b14dd50dff4fc41ec5c5f2ee3e20f4b7f1d141 /usr.sbin/named/ndc/ndc.sh | |
parent | d134390523f594c4e7f1b453b8026b993a1aeebb (diff) |
netbsd: bind 4.9.3
Diffstat (limited to 'usr.sbin/named/ndc/ndc.sh')
-rw-r--r-- | usr.sbin/named/ndc/ndc.sh | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/usr.sbin/named/ndc/ndc.sh b/usr.sbin/named/ndc/ndc.sh new file mode 100644 index 00000000000..402de9dc0c0 --- /dev/null +++ b/usr.sbin/named/ndc/ndc.sh @@ -0,0 +1,85 @@ +#!/bin/sh +# +# $NetBSD: ndc.sh,v 1.1 1996/02/02 15:29:52 mrg Exp $ + +USAGE='echo \ + "usage: $0 \ + (status|dumpdb|reload|stats|trace|notrace|querylog|start|stop|restart) \ + ... \ + "; exit 1' + +PATH=%DESTSBIN%:/bin:/usr/bin:/usr/ucb:$PATH +PIDFILE=%PIDDIR%/named.pid + +if [ -f $PIDFILE ] +then + PID=`cat $PIDFILE` + PS=`%PS% $PID | tail -1 | grep $PID` + RUNNING=1 + [ `echo $PS | wc -w` -ne 0 ] || { + PS="named (pid $PID?) not running" + RUNNING=0 + } +else + PS="named (no pid file) not running" + RUNNING=0 +fi + +for ARG +do + case $ARG in + start|stop|restart) + ;; + *) + [ $RUNNING -eq 0 ] && { + echo $PS + exit 1 + } + esac + + case $ARG in + status) echo "$PS";; + dumpdb) kill -INT $PID && echo Dumping Database;; + reload) kill -HUP $PID && echo Reloading Database;; + stats) kill -%IOT% $PID && echo Dumping Statistics;; + trace) kill -USR1 $PID && echo Trace Level Incremented;; + notrace) kill -USR2 $PID && echo Tracing Cleared;; + querylog|qrylog) kill -WINCH $PID && echo Query Logging Toggled;; + start) + [ $RUNNING -eq 1 ] && { + echo "$0: start: named (pid $PID) already running" + continue + } + rm -f $PIDFILE + named && { + sleep 5 + echo Name Server Started + } + ;; + stop) + [ $RUNNING -eq 0 ] && { + echo "$0: stop: named not running" + continue + } + kill $PID && { + sleep 5 + rm -f $PIDFILE + echo Name Server Stopped + } + ;; + restart) + [ $RUNNING -eq 1 ] && { + kill $PID && sleep 5 + } + rm -f $PIDFILE + named && { + sleep 5 + echo Name Server Restarted + } + ;; + *) eval "$USAGE";; + esac +done +test -z "$ARG" && eval "$USAGE" + +exit 0 |