Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify different times for Monday-Saturday and Sunday in single CRON statement

I need to run a job at this cron schedule, but it seems like I can't express this in one statement. Is there a way to get this in one cron statement?

8am Mon-Sat

2pm Sun

Thanks.

like image 645
mstrom Avatar asked Apr 20 '15 17:04

mstrom


People also ask

What is the use of * * * * * In cron?

It is a wildcard for every part of the cron schedule expression. So * * * * * means every minute of every hour of every day of every month and every day of the week .

How do I schedule a cron job per week?

We can create that cron jobs by using crontab and list them using the crontab -l command. While creating, we can specify the date and time-related fields for the week or optionally a string that is provided of @weekly in the command for creating a cron weekly job.

How do I run a cron job every Sunday?

In general, if you want to execute something on Sunday, just make sure the 5th column contains either of 0 , 7 or Sun . You had 6 , so it was running on Saturday. You can always use crontab. guru as a editor to check your cron expressions.

What is cron expression 0 * * * *?

Meaning of cron expression 0 * * * * *? I think it means the scheduler is expected to run every seconds.


1 Answers

You're right. I'm afraid this is not possible. You'll need to specify two CRON expressions.

like image 97
Biscuits Avatar answered Sep 22 '22 06:09

Biscuits