Crontab cheat sheet: Difference between revisions
Jump to navigation
Jump to search
(Created page with " * 1st Thursday of month # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) #...") |
No edit summary |
||
Line 21: | Line 21: | ||
# | | | | | | # | | | | | | ||
# * * * * * command to be executed | # * * * * * command to be executed | ||
0 15 * * 4 [ $(date +\%d) -ge 8 ] && [ $(date +\%d) - | 0 15 * * 4 [ $(date +\%d) -ge 8 ] && [ $(date +\%d) -le 14 ] && command | ||
*3rd wednesday of month | *3rd wednesday of month | ||
0-7 | |||
8-15 | |||
16-23 | |||
24-31 | |||
# Example of job definition: | # Example of job definition: | ||
# .---------------- minute (0 - 59) | # .---------------- minute (0 - 59) | ||
Line 32: | Line 38: | ||
# | | | | | | # | | | | | | ||
# * * * * * command to be executed | # * * * * * command to be executed | ||
5 03 * * WED [ $(date +\%d) -ge 22 ] && [ $(date +\%d) - | 5 03 * * WED [ $(date +\%d) -ge 22 ] && [ $(date +\%d) -le 28 ] && /usr/bin/logger "Test 3rd Wed of month 03:05" | ||
Revision as of 17:29, 24 January 2023
- 1st Thursday of month
# 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) # | | | | | # * * * * * command to be executed 0 15 * * 4 [ $(date +\%d) -le 07 ] && command
- 2nd Thursday of month
# 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) # | | | | | # * * * * * command to be executed 0 15 * * 4 [ $(date +\%d) -ge 8 ] && [ $(date +\%d) -le 14 ] && command
- 3rd wednesday of month
0-7 8-15 16-23 24-31
# 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) # | | | | | # * * * * * command to be executed 5 03 * * WED [ $(date +\%d) -ge 22 ] && [ $(date +\%d) -le 28 ] && /usr/bin/logger "Test 3rd Wed of month 03:05"
- Reference
https://serverfault.com/questions/986514/crontab-first-wednesday-of-the-month-that-is-followed-by-the-first-monday-of-t
https://stackoverflow.com/questions/58413332/how-to-schedule-a-cron-for-the-first-thursday-of-every-month