- What is a cron expression?
- A cron expression is a string of 5 fields (minute, hour, day-of-month, month, day-of-week) separated by spaces that defines a recurring schedule for automated tasks. It's used by Unix/Linux crontab, Kubernetes, GitHub Actions, AWS, and many other schedulers.
- What does * * * * * mean in cron?
- It means 'run every minute of every hour of every day of every month on every day of the week' — the task executes every single minute. Each asterisk (*) means 'any/every value' for its field.
- How do I run a cron job every 5 minutes?
- Use the expression */5 * * * *. The */5 in the minute field means 'every 5th minute' — it fires at :00, :05, :10, :15, :20, :25, :30, :35, :40, :45, :50, and :55.
- How do I schedule a cron job for Monday through Friday?
- Use 1-5 in the day-of-week field. For example, 0 9 * * 1-5 runs at 9:00 AM every weekday (Monday=1 through Friday=5). The day-of-month and month fields use * for 'every'.
- What is the difference between cron and crontab?
- Cron is the background daemon (service) that executes scheduled tasks. Crontab (cron table) is the configuration file where you define the schedule and commands. You edit the crontab with 'crontab -e'.
- Can cron jobs run every second?
- No, standard cron's smallest unit is one minute. For sub-minute scheduling, you need workarounds like using sleep commands within a per-minute cron job, or specialized schedulers. Quartz cron (Java) supports a seconds field.
- What is the difference between Unix cron and Quartz cron?
- Unix cron uses 5 fields (minute through day-of-week). Quartz adds a seconds field at the start and an optional year field (6-7 fields total), plus supports special characters like ? (no specific value), L (last), W (weekday), and # (Nth occurrence).
- What timezone does cron use?
- Standard system cron uses the server's local timezone. Cloud services vary: AWS uses UTC by default, Kubernetes CronJobs use UTC by default (configurable since v1.25), and GitHub Actions uses UTC. Always verify your platform's timezone behavior.
- How do I test if my cron expression is correct?
- Use this cron expression generator to paste your expression and check the English description and next 10 run times. Verify that the listed dates, times, and days of the week match your intended schedule.
- What does the / character mean in cron?
- The slash (/) defines step intervals. */5 in the minute field means 'every 5th minute' (0, 5, 10, 15...). 10/5 means 'every 5th minute starting at minute 10' (10, 15, 20, 25...). It works in all five fields.