What Cron Jobs Are, How They Work, and Why Silent Failures Cost You

Cron is a Unix background program dating back to 1979 that runs scheduled commands, called cron jobs, based on a five-field time syntax specifying minute, hour, day, month, and weekday. Each cron job lives in a file called the crontab, and the scheduler checks every minute whether any job is due to run. A critical limitation is that cron has no memory — if a machine is off when a job is scheduled, that job is simply skipped with no automatic retry. Common pitfalls include the OR logic applied when both day-of-month and day-of-week fields are set, and hour ranges that extend further than intended, such as '9-17' running jobs until 17:45 rather than 17:00. Tools like crontab.guru, Python's croniter, and Node's cron-parser can help verify schedules before deployment, while platforms like GitHub Actions support the same cron syntax with minor differences such as defaulting to UTC time.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in