FastCron accepts both
*/5 * * * *5 minutes.It will automatically check the expression and calculate the next execution times.
The standard crontab expression consists of 5 fields:
minute hour day month weekday
| Field | Allowed values | Allowed special characters |
|---|---|---|
minute |
0..59 | */,-R |
hour |
0..23 | */,-R |
day |
1..31 | */,-L |
month |
1..12 | */,- |
weekday |
1..7 (Mon..Sun) | */,- |
There are multiple ways to set the values for each field:
* to select all allowed values*/n to select all values with a step number n
*/5 in the minute field will select from 0, 5,
10, to 55*/2 in the day field will select from 1, 3,
5, to 27, 29, 311,2,3,4,5,6,71-71-7/2L at the day field to select the last day of the monthR to select one random value, Rn to select n
random values
R,values to select one random value from a list e.g. R,1-7 will select one
random value from 1 to 7.
Your cronjob will run when the current time matches ALL the fields of the cron expression.
For example, cronjob with the expression 30 7 * 10 Mon will run in October, every Monday at 07:30.
If you select specific values for both the day and weekday fields, it will run when the
current time matches EITHER values.
For example, 30 7 15 10 Mon will run in October, at 07:30 every Monday AND
at 07:30 Oct 15.
If you'd like to run a cronjob at a specific time, see one-time cronjobs.
Due to the limitation of the time values, some cron expressions are impossible (time never matches), some time intervals e.g. every 48 minutes are not available, and some time intervals can't match perfectly e.g., every 2 days. You should use the time expression to fit your requirements.
Here are some popular cron expressions:
| Expression | Meaning |
|---|---|
* * * * * |
Every minute |
*/2 * * * * |
Every 2 minutes |
*/5 * * * * |
Every 5 minutes |
*/10 * * * * |
Every 10 minutes |
*/15 * * * * |
Every 15 minutes |
*/30 * * * * |
Every 30 minutes |
5 * * * * |
Every hour |
5 */2 * * * |
Every 2 hours |
5 */3 * * * |
Every 3 hours |
5 */4 * * * |
Every 4 hours |
5 */6 * * * |
Every 6 hours |
5 */8 * * * |
Every 8 hours |
5 0,12 * * * |
Twice a day |
5 7 * * * |
Every day at 07:05 |
5 7 * * 1 |
Every week, on Monday at 07:05 |
5 7 15 * * |
Every month, on day 15, at 7:05 |
FastCron also supports simple time expressions like 5 minutes or next Friday 7:05 PM.
Internally, it uses the PHP function
strtotime.
It works by calculating the next execution times based on the current execution time.
If you enter a specific time e.g. Oct 16, 2024 07:50 PM, then it will run only once.
Here are some popular time expressions:
| Expression | Meaning |
|---|---|
10 seconds |
Every 10 seconds |
30 seconds |
Every 30 seconds |
1 minute |
Every minute |
5 minutes |
Every 5 minutes |
14 minutes |
Every 14 minutes |
1 hour |
Every hour |
7 hours |
Every 7 hours |
1 day |
Every day |
1 day 17:05 |
Every day at 17:05 |
2 days |
Every 2 days |
2 days 17:05 |
Every 2 days at 17:05 |
next Friday 17:05 |
Every week, on Friday at 17:05 |
2 weeks Friday 17:05 |
Every 2 weeks, on Friday at 17:05 |
1 month 17:05 |
Every month at 17:05 |
first day of next month 17:05 |
Every first day of the month, at 17:05 |
last day of next month 17:05 |
Every last day of the month, at 17:05 |
If you need help choosing the right cron expression, email me and I'll help.
Need help? Reach out to support@fastcron.com - we're happy to help.
See why 8,000+ website developers and their teams use FastCron to run their cronjobs 12 million times a day.
The reliable online cronjob service for your websites since 2009.