From owner-freebsd-questions Wed Aug 23 4: 1:39 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mw5.texas.net (mw5.texas.net [206.127.30.15]) by hub.freebsd.org (Postfix) with ESMTP id 471FB37B423 for ; Wed, 23 Aug 2000 04:01:32 -0700 (PDT) Received: from localhost.texas.net (tcnet01-58.austin.texas.net [209.99.40.58]) by mw5.texas.net (2.4/2.4) with ESMTP id GAA02608; Wed, 23 Aug 2000 06:01:29 -0500 (CDT) Received: (from dread@localhost) by localhost.texas.net (8.9.3/8.9.3) id FAA02943; Wed, 23 Aug 2000 05:11:20 -0500 (CDT) (envelope-from dread) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <000001c00c63$c5f77b40$99f438cb@gosvald> Date: Wed, 23 Aug 2000 05:10:53 -0500 (CDT) From: Don Read To: George Osvald Subject: RE: crontab Cc: freebsd-questions@FreeBSD.ORG Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 22-Aug-00 George Osvald wrote: > Hello everyone! > > My ISP where I have my web page, is running freeBSD 4.0. I do not know a lot > about it. I know how to use crontab to start a script at certain time how > ever how do I use crontab to check on the script that is already running? I > have a long running script and restarting it when it is already running > doesn't make sense. That only produces a error message. > > to start it I would be using something like: > > 5 * * * * root ./start > > This would start the script every five minutes. Now how do I check if the > script is running after it's been started and if it wasn't to restart it > again. Can anyone help? > a directory lock : mkdir /tmp/lck.cron > /dev/null 2>&1 || exit echo "got lock, job running" ... your stuff here ... rmdir /tmp/lck.cron echo "job done" Regards, -- Don Read dread@texas.net --- The problem with people who have no vices is that you can be sure they're going to have some pretty annoying virtues. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message