On 2009-04-23, Sjoerd Hardeman <sjo...@lorentz.leidenuniv.nl> wrote: > This is an OpenPGP/MIME signed message (RFC 2440 and 3156) > --------------enig96969A47323B843026EC6D74 > Content-Type: text/plain; charset=UTF-8; format=flowed > Content-Transfer-Encoding: quoted-printable > > Kurian Thayil wrote: >> Hi All, >> =EF=BF=BD >> I have 3 cron jobs enabled and all are relating to RSYNC. Now, all of=20 >> these scripts are run once in every 7 minutes all day. The problem=20 >> occurs when the scripts doesn't finish to execute in 7 minutes. This=20 >> will result in starting execution of the same script again and this wil= > l=20 >> malfunction the setup. >>=20 >> 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? > You could create a lockfile > touch /var/lock/cronfiletest > and the test if this lockfile exists, or else exit > test -f /var/lock/cronfiletest || exit 0 Should it be this? test -f /var/lock/cronfiletest && exit 0 if you want to exit when the lock file exist.
> You'll find similar tricks in many cron and init scripts. > > Sjoerd > > PS. Kurian, my apologies for the message sent to you. Hit the 'reply'=20 > vs. 'reply to list' button accidentally. > > > --------------enig96969A47323B843026EC6D74 > Content-Type: application/pgp-signature; name="signature.asc" > Content-Description: OpenPGP digital signature > Content-Disposition: attachment; filename="signature.asc" > > > --------------enig96969A47323B843026EC6D74-- > > -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org