Hello,
I want to use both anacron and cron but with priority given to cron because I would prefer that my specific task is triggered at a specific time.
So let's assume my script to be triggered is /root/myTask.sh.
I want it to run at 3.00 am daily.
As a backup, if my laptop was off or something, I want anacron to launch it ASAP.
Here is my implementation:
Quote:
Originally Posted by /etc/crontab
0 3 * * * /root/myTask.sh; anacron -u myTask
|
Quote:
Originally Posted by /etc/anacrontab
@daily 20 myTask /root/myTask.sh
|
/root/myTask is executable
Everything should work as expected EXCEPT if my laptop reboots between 0.00 and 3.00 because anacron will launch myTask AND then cron as well at 3.00.
What is the best practice to make sure cron doesn't launch a task already launched by anacron please? Is it by creating a kind of flag/file and checking its value by cron?
Thank you in advance