From owner-freebsd-questions Mon Aug 11 15:32:08 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id PAA04489 for questions-outgoing; Mon, 11 Aug 1997 15:32:08 -0700 (PDT) Received: from mail.san.rr.com (san.rr.com [204.210.0.1]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id PAA04459 for ; Mon, 11 Aug 1997 15:32:00 -0700 (PDT) Received: (from uucp@localhost) by mail.san.rr.com (8.7.6/8.7.3) id PAA19729 for ; Mon, 11 Aug 1997 15:31:29 -0700 (PDT) Message-Id: <199708112231.PAA19729@mail.san.rr.com> Received: from dt5h1n61.san.rr.com(204.210.31.97) by mail via smap (V1.3) id tmp019621; Mon Aug 11 15:31:00 1997 From: "Studded" To: "FreeBSD Questions" Date: Mon, 11 Aug 97 15:30:35 -0800 Reply-To: "Studded" Priority: Normal X-Mailer: PMMail 1.92 For OS/2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: Possible cron bug Sender: owner-freebsd-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk I am working on an sh script to be run by cron every 5 minutes to check and see if a certain process is running, and if it's not to start it up. I have a script that works just fine for this task, however on those occasions that the process is not running and it needs to start it, I get some unusual leftovers from cron that I would like to eliminate, or at least verify to be non-harmful. In the following script, adjkerntz is the guinea pig process (since I don't want to kill the one I'm actually testing for :), however the behaviour is the same. System is 2.2.1-Release. Here is the script: #!/bin/sh /bin/ps -ax | /usr/bin/grep [a]djkerntz if [ $? != 0 ]; then /sbin/adjkerntz -i fi exit Here is the cron job: */2 * * * * root /bin/sh /home/root/test.sh And here is the result from ps when it has to start the process: 6591 ?? I 0:00.01 CRON (cron) 6592 ?? Z 0:00.00 (sh) 6598 ?? Is 0:00.01 /sbin/adjkerntz -i A kill for 6591 in this example also eliminates the zombie (sh) process, and the ghost CRON thinger doesn't seem to have any adverse affect on the system, however I don't want to take chances since the whole point of this is to have it run safely unattended. I've tried the script with and without using an & to bg the process (although it shouldn't be needed with a daemon like adjkerntz), and with and without the exit statement. I've also tried it on several other FreeBSD systems and with different processes to start, and the result is always the same. Also, the CRON (cron) process takes up some small amount of memory (about 500 bytes). I haven't had a chance to test long term if the amount of memory used increases, since I don't have any systems that I can take chances with right now. I am not doing a send-pr yet since I'm still not sure this isn't an error on my part, however I've researched everything I can find on this, and haven't found any mention of the problem I'm describing here. If it would be better to send this to -bugs or do a send-pr, just let me know. Thanks, Doug Do thou amend they face, and I'll amend my life. -Shakespeare, "Henry V"