Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Aug 2000 05:10:53 -0500 (CDT)
From:      Don Read <>
To:        George Osvald <>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   RE: crontab
Message-ID:  <>
In-Reply-To: <000001c00c63$c5f77b40$99f438cb@gosvald>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help

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"

Don Read                               
--- 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
with "unsubscribe freebsd-questions" in the body of the message

Want to link to this message? Use this URL: <>