Date: Wed, 23 Aug 2000 08:55:11 -0700 From: Fred Condo <fred@condo.chico.ca.us> To: freebsd-questions@FreeBSD.ORG Subject: Re: crontab Message-ID: <20000823085511.B5417@absinthe.condo.chico.ca.us> In-Reply-To: <XFMail.000823051053.dread@texas.net>; from dread@texas.net on Wed, Aug 23, 2000 at 05:10:53AM -0500 References: <000001c00c63$c5f77b40$99f438cb@gosvald> <XFMail.000823051053.dread@texas.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000823085511.B5417>