Originally Posted by Winanjaya
I have a cron job that running every 5 minutes (*/5 * * * * dosomething)
how to abort cron if the previous cron job not yet finished?
Thanks & Regards
You can abort execution of the dosomething.
In your dosomething script, you can add something like this,
When the dosomething starts , then it will create a lockfile somewhere and after finishing dosomething it will delete that lockfile.
Before creating the lockfile in dosomething, it will check whether that lockfile exists, and if exists then dosomething will exit without proceeding further.
Add this to you dosomething file.
Check the dosomething entry in your ps list , if running then it will simply exit without doing anything and if no entry in ps , then dosomthing will do its something.