On Thu, Apr 23, 2009 at 5:19 AM, mark <m.roth2006@xxxxxxx> wrote: > Kurian Thayil wrote: > > Hi All, > > > > I am using RHEL 5.2 Server and I have 3 cron jobs enabled and all are > > relating to RSYNC. Now, all of these scripts are run once in every 7 > minutes > > all day. The problem occurs when the scripts doesn't finish to execute in > 7 > > minutes. This will result in starting execution of the same script again > and > > this will malfunction the setup. > > > > Is there an option in CRON, which always check if CRON has started the > > process and is already running? Cron should execute the script only if > the > > the process isn't running already. Any hints on this? > > Not that I know of. Sounds like you'll have to add code to the scripts to > see > if it's still running, and sleep if it is; along the lines of > > while [ ( ps -ef | grep myscript -c ) > 1 ]; do > sleep 60 > done > > (I'm sure I'd have to fiddle with the test, but I don't have time at the > moment.) > > mark > > An exit is probably better than sleeping. I like the lockfile except for the need for a watchdog. Something about "write the script correctly and you won't need a watchdog" never seems to apply in real life. -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list