From owner-freebsd-questions Wed Aug 23 8:55:19 2000 Delivered-To: freebsd-questions@freebsd.org Received: from absinthe2.dyndns.org (adsl-63-192-100-110.dsl.chic01.pacbell.net [63.192.100.110]) by hub.freebsd.org (Postfix) with ESMTP id 2A9E037B422 for ; Wed, 23 Aug 2000 08:55:12 -0700 (PDT) Received: (from fred@localhost) by absinthe2.dyndns.org (8.9.3/8.9.3) id IAA08433 for freebsd-questions@FreeBSD.ORG; Wed, 23 Aug 2000 08:55:12 -0700 (PDT) (envelope-from fred) Date: Wed, 23 Aug 2000 08:55:11 -0700 From: Fred Condo To: freebsd-questions@FreeBSD.ORG Subject: Re: crontab Message-ID: <20000823085511.B5417@absinthe.condo.chico.ca.us> Mail-Followup-To: freebsd-questions@FreeBSD.ORG References: <000001c00c63$c5f77b40$99f438cb@gosvald> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from dread@texas.net on Wed, Aug 23, 2000 at 05:10:53AM -0500 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, Aug 23, 2000 at 05:10:53AM -0500, Don Read wrote: > > 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 Making this in /tmp exposes the script to a denial of service attack. If an attacker creates /tmp/lck.cron, then the script will never run. Best to create your locks under a directory you own. > > 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 -- Fred Condo + fred@condo.chico.ca.us Not since Tom Hanks won an Oscar has there been that much acting in Philadelphia. -- Sen. Joe Lieberman, about the Republican Convention. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message