Cron schedule examples: every 15 minutes, weekdays at 8, the first of the month

A cron schedule has five fields, in this order: minute, hour, day of the month, month and day of the week. An asterisk means “every”. The rest is learnt from examples, and these are the ones people look up most. To create the job, see cron jobs: what they are for and how to create one.

The most requested schedules

You want it to run Write How to read it
Every 15 minutes */15 * * * * At minutes 0, 15, 30 and 45 of every hour.
Every hour 0 * * * * At minute 0 of every hour.
Every day at 2:30 30 2 * * * Minute 30, hour 2, every day.
Weekdays at 8:00 0 8 * * 1-5 Monday (1) to Friday (5).
At 9:00 and 17:00 0 9,17 * * * The comma separates values.
Every two hours 0 */2 * * * At 0, 2, 4, 6 and so on.
Monday at 6:00 0 6 * * 1 Day of the week 1.
The 1st of each month, at midnight 0 0 1 * * Day of the month 1.
Once a year, on 1 January 0 0 1 1 * Day 1, month 1.

How to fill it in on cPanel

1 On the cron page, pick from “Common Settings” whatever looks closest to what you want. The five fields fill themselves in.
2 Correct by hand whatever needs it. Each field is its own box, and */15 goes in the minute box.
3 Check it against the table above, reading it aloud: “minute 0, hour 8, every day, every month, Monday to Friday”.
4 Remember that the time is the server’s. See the server time.

Traps that catch people out

Trap What happens
Day of the month and day of the week both filled in In general cron runs when either one matches, not when both do. 0 8 1 * 1 runs on the 1st and on every Monday.
“Every other day” with */2 It counts from the 1st of each month. In a 31-day month, the 31st and the 1st come one after the other.
“On the last day of the month” There is no value for that. Schedule it daily and let the script check whether tomorrow is the 1st.
A * in the minute * 8 * * * runs 60 times between 8:00 and 8:59. You almost always wanted 0 8 * * *.
The commonest mistake is the asterisk in the minute. Someone wants “at 8 in the morning”, writes * 8 * * * and wakes up to sixty runs. Put 0 in the minute whenever you want once at the stated hour.
Pick minutes that are not round numbers when you have several jobs, such as 7 and 23 instead of 0 and 30. It stops them all starting together and tripping over each other.

Have a script and cannot work out the schedule? Tell us when you want it to run and open a ticket.

Open a ticket

SEE ALSO

Cron jobs: what they are for and how to create one

A cron job that does not run or sends no output: a checklist

n8n Schedule Trigger or a cron job: which to use

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from 321,75 MT/mo (3-year plan, with coupon)

See plans
  • 0 Users Found This Useful
Was this answer helpful?