0

I would like to make a cron expression that runs at 11:30 a.m. and 7 p.m. every day. But 0 30 11,19 ? * * * runs at 11h30 and 19h30 And 0 30,0 11,19 ? * * * runs at 11h, 11h30, 19h and 19h30 How can I write the cron expression to do what I want ? Thanks for your help.

0

1 Answer 1

5

Just add two lines:

30 11 * * * some-command
0  19 * * * some-command

To factorise the code to avoid having to repeat it, you could store it in an environment variable:

CODE = some sh code here
30 11 * * * eval "$CODE"
0  19 * * * eval "$CODE"

Or even:

CODE = some sh code here
RUN = eval eval "$CODE"
30 11 * * * $RUN
0  19 * * * $RUN

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .