Date: Fri, 17 Jan 97 01:21:26 -0800 From: "That Doug Guy" <tiller@connectnet.com> To: "FreeBSD-questions@freebsd.org" <FreeBSD-questions@freebsd.org> Subject: Crontab for killing and restarting named Message-ID: <199701170922.BAA09807@connectnet1.connectnet.com>
index | next in thread | raw e-mail
Ok, this is driving me nutty. I need to kill named once a day, and then
restart it. First I tried a command line to do this in the crontab, but I couldn't get
that to work, so I decided to use a script. Here is the script that I ended up with:
#!/bin/sh
PID=`/bin/ps ax | /usr/bin/grep named | /usr/bin/grep -v grep | /usr/bin/awk
'{print $1}'`
/bin/kill -9 ${PID}
/bin/sleep 5
/usr/sbin/named
The only problem is, it doesn't work properly. When I run it from the command
line, it kills named, then hangs. I have to kill the script with ^C. Here is the error
(named was pid 8781):
[root@dalnet ~/bin] 123# kill-named
Killed
kill: [root@dalnet ~/bin] 124# 8793: No such process
It seems to be trying to kill the processes that start as a result of the script too, but
I'm not sure why. I tried it without the last 2 lines, same result. If I can just get it
to kill the process and then exit cleanly I can restart named with a crontab one
minute later than the one that runs the script, but I'd really like to avoid having it
down for a full minute if possible.
Apologies to anyone who thinks this is not a proper use of this list, but it
*is* a FreeBSD system. :) Flames in private please.
Thanks,
Doug
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701170922.BAA09807>
