The requirement is to run a cron on an hourly/daily basis.
But sometimes, the cron takes too long to complete before the subsequent execution.
So, when the subsequent execution starts, it shouldn't run 2 parallel jobs.
Instead, it is supposed to kill the already executing job & start a new one.
I tried the following but nothing worked.
- pkill & run my script in cron - this, this & this
pgrep
&kill
instead ofpkill
in above solution - a one-liner bash using&&
&;
- run-one &
run-this-one
also in it.
What's the best way to do it?