How to Skip Saturday and Sunday in a Cron Expression

Cron expression with excluding of a specific day of week

Using cronmaker.com, an example Cron schedule that executes every day except Monday at 12pm would be:

0 0 12 ? * TUE,WED,THU,FRI,SAT,SUN *

Obviously the site will let you tailor this as required, but hopefully if the site ever goes down, and someone has a similar example, they will be able to use this expression as a guide to creating their own.

Schedule Cron to skip first Saturday of every month

Since there seem to be no option in Cron.
I'm going with script for the above need.

**if [ $(date +%d) -le 7 ] && [ $(date +%u) -eq 1 ] ;**

[ $(date +%d) -le 7 ] - Checks if the days fall in first 7 days of month

[ $(date +%u) -eq 6 ] - Checks if day is equal to Saturday

Thanks.

Spring Cron expression to exclude running job on one day for set times

Try

@Scheduled(cron = "0 15 2-23 * * SUN") 

Crontab skip run once a week

Make it 2 lines:

0 0,8,16 * * 0-5 At minute 0 past hour 0, 8, and 16 on every day-of-week from Sunday through Friday.

And

0 8,16 * * 6 At minute 0 past hour 8 and 16 on Saturday.

You can change the day and hour which you want to skip, but there is no way to do this in 1 line as far as I know.



Related Topics



Leave a reply



Submit