Development (General)

What is a cron job? Cron syntax explained

What a cron job is and how to read a cron expression: the time fields, what the asterisk means, common schedules and the mistakes that make jobs fail quietly.

  • 7 min read
  • 5 questions
  • +35 XP
Transcript

Cronjobs, explained by cats. Kitty has tasks. Important tasks. Backup the database. Clean old logs. Send daily reports. But Kitty doesn't want to run this manually. Every single time. So she uses a cron job. cron is a scheduler tool.

It runs commands at specific times. Automatically. Want to take backups everyday? Set a cronjob. Cron uses a pattern. Six numbers. Seconds. Minute. Hour. Day. of the month, Month. and day of the week. Now here’s the magic symbol: It just means, ‘Every’.

For example: Every second. Every hour. Every day. Looks scary. But it's just defines a schedule. Once set, Kitty doesn’t touch it again. It just runs. That’s a cron job. set it once, forget it forever, and let the system do the work.