diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-05-22 19:34:47 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-05-22 19:34:47 +0000 |
commit | f8b71c5ea58fb8dcd68202c4efdd3e8b15a0b148 (patch) | |
tree | 0ca29d26430ed386a9a613423a7aef69bf76ec5c /usr.sbin/named/ndc | |
parent | bc0769ea48a7310df5fd1661f0853e72291568ab (diff) |
stash argv in pid file like sendmail does so we can restart w/ args. also make ndc work even if ps does not.
Diffstat (limited to 'usr.sbin/named/ndc')
-rw-r--r-- | usr.sbin/named/ndc/ndc.sh | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/usr.sbin/named/ndc/ndc.sh b/usr.sbin/named/ndc/ndc.sh index 417ea5924c2..d77a44753d8 100644 --- a/usr.sbin/named/ndc/ndc.sh +++ b/usr.sbin/named/ndc/ndc.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: ndc.sh,v 1.5 1997/03/12 14:51:57 downsj Exp $ +# $OpenBSD: ndc.sh,v 1.6 1998/05/22 19:34:46 millert Exp $ USAGE='echo \ "usage: $0 \ @@ -9,15 +9,24 @@ USAGE='echo \ PATH=%DESTSBIN%:/bin:/usr/bin:/usr/ucb:$PATH PIDFILE=%PIDDIR%/named.pid +NAMED_CMD=named if [ -f $PIDFILE ] then - PID=`cat $PIDFILE` + PID=`sed 1q $PIDFILE` + NAMED_CMD=`tail -1 $PIDFILE` + if kill -0 $PID >/dev/null 2>&1; then + RUNNING=1 + else + RUNNING=0 + fi PS=`%PS% $PID | tail -1 | grep $PID` - RUNNING=1 [ `echo $PS | wc -w` -ne 0 ] || { - PS="named (pid $PID?) not running" - RUNNING=0 + if [ $RUNNING -eq 1 ]; then + PS="named (pid $PID) can't get name list" + else + PS="named (pid $PID?) not running" + fi } else PS="named (no pid file) not running" @@ -50,7 +59,7 @@ do continue } rm -f $PIDFILE - named && { + $NAMED_CMD && { sleep 5 echo Name Server Started } @@ -71,7 +80,7 @@ do kill $PID && sleep 5 } rm -f $PIDFILE - named && { + $NAMED_CMD && { sleep 5 echo Name Server Restarted } |