From owner-freebsd-questions Fri Jan 17 01:22:19 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id BAA19710 for questions-outgoing; Fri, 17 Jan 1997 01:22:19 -0800 (PST) Received: from connectnet1.connectnet.com (tiller@connectnet1.connectnet.com [207.110.0.50]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id BAA19704 for ; Fri, 17 Jan 1997 01:22:17 -0800 (PST) Received: (tiller@localhost) by connectnet1.connectnet.com (8.8.4/Connectnet-3.0) id BAA09807; Fri, 17 Jan 1997 01:22:11 -0800 (PST) Message-Id: <199701170922.BAA09807@connectnet1.connectnet.com> From: "That Doug Guy" To: "FreeBSD-questions@freebsd.org" Date: Fri, 17 Jan 97 01:21:26 -0800 Reply-To: "That Doug Guy" Priority: Normal X-Mailer: That Doug Guy's Registered PMMail 1.53 For OS/2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: Crontab for killing and restarting named Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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