I added this to /etc/crontab on a few different linux & freebsd systems:
# monthly reboot: 3rd Tuesday of every month 56 07 15-21 * 2 root /sbin/shutdown -r now
I want a reboot on the 3rd TUESDAY of every month. However, all the systems rebooted on the 3rd Wednesday of this month (the 19th).
What am I doing wrong?
Update: Thanks to Ranon's answer below, looks like the below revision will work, can anyone confirm or is there an even better way of doing it?
# monthly reboot: 3rd Tuesday of every month 56 07 15-21 * * root test $(date +\%u) -eq 2 && /sbin/shutdown -r now