diff options
author | peter <peter@FreeBSD.org> | 1995-08-20 21:32:49 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1995-08-20 21:32:49 +0000 |
commit | ed44ed4dc65cc45a08261a9fd0f6a69be8df7eaa (patch) | |
tree | acf821cb88d4bd07f57bacabc68ac2fdc65b8fdb /usr.sbin | |
parent | 4431a8a9dc1be01609d0e91641fe60dc6bfdae8f (diff) | |
parent | 3b894f576160a2aecb7b14e0329113ed5f96b31a (diff) | |
download | FreeBSD-src-ed44ed4dc65cc45a08261a9fd0f6a69be8df7eaa.zip FreeBSD-src-ed44ed4dc65cc45a08261a9fd0f6a69be8df7eaa.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r10137,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/named/tools/ndc/ndc.sh | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/usr.sbin/named/tools/ndc/ndc.sh b/usr.sbin/named/tools/ndc/ndc.sh new file mode 100644 index 0000000..a9a0557 --- /dev/null +++ b/usr.sbin/named/tools/ndc/ndc.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +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 + +[ -f $PIDFILE ] || { + echo "$0: $PIDFILE does not exist" + exit 1 +} +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 +} + +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 + } + %INDOT%named && echo Name Server Started + ;; + stop) + [ $RUNNING -eq 0 ] && { + echo "$0: stop: named not running" + continue + } + kill $PID && { + sleep 5 + echo Name Server Stopped + } + ;; + restart) + [ $RUNNING -eq 1 ] && { + kill $PID && sleep 5 + } + %INDOT%named && echo Name Server Restarted + ;; + *) eval "$USAGE";; + esac +done +test -z "$ARG" && eval "$USAGE" + +exit 0 |