Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cron expression to run job twice a day at different time?

I have one job that needs to be execute twice a day at different time . e.g. 10:00 and 15:30. How can i achieve this ?

I am confuse because minute is different for both the time. For 11:00 and 15:00 its easy because for both the times, minute portion is same, but for the different minute portion is it feasible with cron ?

Thanks in Advance and apologies for silly question.

like image 653
Ravi Parmar Avatar asked Sep 07 '15 08:09

Ravi Parmar


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 run cron in alternate days?

1 Answer. The cron statement for each script execute on the same days - */2 evaluates to 1-31/2 . See my answer here for more details. To get alternating days, you could use 2-31/2 for the first script - this would start at 2 and skip every other for 2,4,6 etc.

Can 2 cron jobs run at the same time?

We can run several commands in the same cron job by separating them with a semi-colon ( ; ). If the running commands depend on each other, we can use double ampersand (&&) between them. As a result, the second command will not run if the first one fails.

What is cron expression 0 * * * *?

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


1 Answers

Try following which you will get closest in one expression

0 0 10,15/12 * * ?

this will run 10:00 and 15:00.

like image 134
jjj Avatar answered Sep 30 '22 11:09

jjj