How to read cron expressions
Cron is the scheduler that runs a command on the server at set times, used for backups, mail queues, stock syncs and WordPress scheduled tasks. The schedule is written as a five-field expression.
The five fields
In order: minute (0–59), hour (0–23), day of month (1–31), month (1–12) and day of week (0–7; 0 and 7 are Sunday). “30 3 * * *” runs every day at 03:30.
Special characters
- * every value
- */5 every 5 (every 5 minutes in the minute field)
- 1-5 a range (Monday–Friday in the weekday field)
- 1,15 a list (the 1st and 15th)
For example, “*/10 8-18 * * 1-5” runs every 10 minutes between 08:00 and 18:50 on weekdays.
Common mistakes
- Day and weekday together: if both are set, cron combines them with OR, not AND.
- Time zone: the server may use a different time zone from yours.
- Running too often: a heavy script every minute can hit resource limits on shared hosting.
- Unwanted emails: without “>/dev/null 2>&1” at the end, output is emailed after every run.
Adding it in cPanel
Enter the schedule and command on cPanel's Cron Jobs screen. For a PHP script, write the full path of PHP and of the file.
The cron expression generator explains your expression, lists the next run times and prepares the command to paste into cPanel.
Comments0
No Comments Yet
Be the first to share your thoughts.
Please sign in or sign up to leave a comment.