Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jan 1997 12:18:55 +0200 (IST)
From:      Nadav Eiron <nadav@barcode.co.il>
To:        That Doug Guy <tiller@connectnet.com>
Cc:        "FreeBSD-questions@freebsd.org" <FreeBSD-questions@freebsd.org>
Subject:   Re: Crontab for killing and restarting named
Message-ID:  <Pine.BSF.3.91.970117121806.28242A-100000@gatekeeper.barcode.co.il>
In-Reply-To: <199701170922.BAA09807@connectnet1.connectnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On Fri, 17 Jan 1997, That Doug Guy wrote:

> 	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

It seems that the process that runs the script will also come up in your 
little grep/awk pipe (it has named in it's name, and doesn't have grep)!

> 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
> 
> 
Nadav



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.970117121806.28242A-100000>