r/tech.unpacked01 · u/tech.unpacked01 ·

How a cron job works: five fields checked every minute

How a cron job works: five fields checked every minute

Cron doesn't plan ahead. It checks the clock every minute.

A cron line is five fields and a command. 30 9 * * 1-5 means 9:30 on weekdays. At 9:29 the minute doesn't match, so nothing happens. At 9:30 on Friday all five match and the job runs. Over the weekend it checks 4,320 more times before Monday matches.

Save this for the next time you write a crontab.

#cron #linux #devops #sysadmin #coding #technology