Cron syntax
A crontab line has five time fields followed by the command:
┌───────── minute (0–59)
│ ┌─────── hour (0–23)
│ │ ┌───── day of month (1–31)
│ │ │ ┌─── month (1–12 or JAN–DEC)
│ │ │ │ ┌─ day of week (0–7 or SUN–SAT; 0 and 7 are Sunday)
* * * * * command
*any value ·5a value ·1-5a range ·1,15a list ·*/10every 10th value ·9-17/2every 2nd value in a range.- Shortcuts:
@hourly,@daily,@weekly,@monthly,@yearly,@reboot. - If both day-of-month and day-of-week are restricted, the job runs when either matches:
0 0 1 * 1runs on the 1st and on every Monday.
Time zones and daylight saving
Cron uses the server's local time zone (often UTC on cloud servers — check with timedatectl or date). Pick the server's zone above to
see when jobs will really run. When clocks spring forward, times in the skipped hour don't exist (for example 02:30 on the last Sunday of March in Europe);
when they fall back, times in the repeated hour occur twice. Many cron implementations run such jobs once, at slightly shifted times — schedule
important jobs outside 01:00–03:00, or run the server in UTC.
Common pitfalls
- Cron runs with a minimal environment: use absolute paths for commands and files, and set
PATHat the top of the crontab if needed. - Output is emailed or lost; append
>> /var/log/myjob.log 2>&1to keep it. %has a special meaning in crontab lines and must be escaped as\%(for example indate +\%F).- Six-field expressions with seconds are for Quartz, Spring and node-cron, not for system crontab. Kubernetes CronJobs and GitHub Actions use the five-field format shown here (GitHub always in UTC).
Is my data uploaded?
No. Everything is calculated in your browser, so nothing you add is sent to gratistools.be. See the privacy page for details.