2

I try to schedule a task in Ubuntu 16.04 using crontab:

45 2 * * 4/2 sh /var/lib/libvirt/images/backups/backup_res.sh

I want it to be executed every other Thursday at 2:45AM. However, I keep getting bad day-of-week error. If I remove /2, it works fine. What could be the problem?

1 Answers1

0

I think the best way is:

45 2 * * Thu expr `date +\%s` / 604800 \% 2 >/dev/null || sh /var/lib/libvirt/images/backups/backup_res.sh

please see this Q&A

A1Gard
  • 4,070
  • 4
  • 31
  • 55