Chris
Chris

Reputation: 15

Need to combine 2 cron lines to 1 if possible

I need to create a cron entry that will kick off a command at both 11:30AM and 4:00PM monday through friday. Is there anyway to do this in one entry or will I need to use two?

This would be great for anyone who has specific times to run their job that don't fall on the same minute of the hours it runs.

Currently I can only figure a two line systems as follows, is this the only way?

# 30 11 * * 1-5 /cmd1

# 00 16 * * 1-5 /cmd1

Upvotes: 0

Views: 115

Answers (2)

fedorqui
fedorqui

Reputation: 289725

It is not possible to combine it on just one line.

What you suggest to do:

30 11,16 * * 1-5 /cmd1

would execute even at 16.30.

Then, the only way is splitting in two pieces as you already have:

30 11 * * 1-5 /cmd1
00 16 * * 1-5 /cmd1

Upvotes: 1

Edouard Thiel
Edouard Thiel

Reputation: 6228

You may try this :

30 11,16 * * 1-5 /cmd1

if you accept to change the time of the second command to 16:30.

Upvotes: 0

Related Questions