A little while ago, I had to set up a backup script using cron. dcron is my favourite cron implementation.
I have been using dcron since a few years, and it has served me well. But this time, my requirement was a bit complicated.
What I wanted to do was: Run the backup script every two days.
Now, this may sound simple to achieve using any cron implementation. Fair enough, it can be done by specifying something like the following in a crontab:
0 8 */2 * * script.sh
The above syntax will execute the given script at 8 AM, every 2 days.
So, what's the catch?
Well, the catch is that this method has a huge limitation — which is — that it requires the computer to be running at the time specified, or the job will be missed.
I need to run the script on my personal computer, which isn't powered on all the time. So, this syntax was ruled out.