Cron syntax is used to describe when a scheduled task should run. You may see cron fields in places such as Ptero schedules, cPanel cron jobs, and other hosting control panels.
Cron fields
A cron schedule is usually split into five fields:
- Minute controls the minute of the hour. For example,
0runs at the start of the hour. - Hour controls the hour of the day, using 24-hour time. For example,
3means 3 AM. - Day of Month controls the day number in the month. For example,
1means the first day of the month. - Month controls which month the task runs in. For example,
1means January. - Day of Week controls which weekday the task runs on. Depending on the system, Sunday may be
0or7.
Common values
The * symbol means every possible value for that field. You can also use numbers, ranges, lists, and step values. A step value uses / to say how often something should repeat inside that field.
*means every value.0means that exact value.1,3,5means a list of values.1-5means a range of values.*/5means every 5 in that field. For example, in the Minute field it means every 5 minutes. In the Hour field it means every 5 hours.
Examples
0 * * * * Runs every hour 0 3 * * * Runs every day at 3 AM */30 * * * * Runs every 30 minutes 0 0 * * 1 Runs every Monday at midnight 0 0 1 * * Runs on the first day of every month
If your control panel offers preset schedule options, use those unless you specifically need custom timing.
