Matt Elhotiby
Matt Elhotiby

Reputation: 44066

What is the syntax for a cron job that runs 15 and 45 minutes after the hour?

What is the syntax for a cron job that runs 15 and 45 minutes after the hour? (So every 30 minutes.)

Would the syntax be something like:

15,45,30   *       *       *       *       wget -O /dev/null http://somesite.com/4_leads.php

So for example it would run at

2:15
2:45
3:15
3:45
4:15
4:45

and so on

Upvotes: 15

Views: 34244

Answers (1)

Marty
Marty

Reputation: 8270

From man 5 crontab

field          allowed values
-----          --------------
minute         0-59
hour           0-23
day of month   1-31
month          1-12 (or names, see below)
day of week    0-7 (0 or 7 is Sun, or use names)

Or, in other words

# m   h   dom mon dow   user          command
15,45 *    *   *   *    yourusername  wget -O /dev/null http://somesite.com/4_leads.php

Skip the username field if you place the entry in a user specific crontab, via crontab -e, crontab -e -u yourusername, or similar.

This question may be better suited to serverfault.

Upvotes: 38

Related Questions