Home/Tech/Cron
Home/Tech/Cron
A standard cron expression consists of five fields separated by spaces. Each field represents a unit of time:
0 0 * * *) is a common mistake. If many
jobs run at the same time, it can spike server load. Instead, use a random minute like
17 0 * * * to spread the load.
Cron runs in the server timezone, NOT your local time. If your server is in UTC and you're in EST, your '9 AM' cron will run at 4 PM local time. Always check your server's timezone first!
1,15,30).1-5 for Mon-Fri).*/15 for every 15 minutes).A cron expression is a string of 5 fields separated by spaces that represents a time schedule. The fields are: Minute (0-59), Hour (0-23), Day of Month (1-31), Month (1-12), and Day of Week (0-6, where 0 is Sunday).
Use the expression */5 * * * *. The */5 in the minute field means "every 5
minutes".
The asterisk (*) is a wildcard that means "every". For example, * in the hour field
means "every hour".
Use the expression 0 2 * * *. This sets the minute to 0 and the hour to 2, running once
daily at 2:00 AM.