cronjob runs on the wrong day of week
Dear all,
My crontab looks as follows:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
00 7 8-14 * 2 root mailx -s "Dry Run E-Stage" foo@example.com < /dev/null
00 7 15-21 * 2 root mailx -s "Dry Run Q-Stage" foo@example.com < /dev/null
00 7 22-28 * 2 root mailx -s "Dry Run P-Stage" foo@example.com < /dev/null
The mailx commands are only for testing purpose. In the future they should be replaced by scripts. These scripts should run on any second, third and fourth tuesday of a month. But I got an email with the subject Dry Run Q-Stage, today on friday.
Could someone please tell me what is wrong here? Did I make a mistake anywhere in the crontab syntax?
Kind regards,
Joerg
Responses
Jorg,
This is expected behaviour.
man 5 crontab
Note: The day of a command's execution can be specified by two fields - day of month, and day of week. If both fields are restricted (ie, aren't *), the command will be run when either field matches the current time. For example, "30 4 1,15 * 5" would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
