Cron Expression Examples: Schedule Any Job

Utilko Team 5 min read Developer

What Is a Cron Expression?

A cron expression is a string of five (or six) fields that defines a schedule for running automated tasks, called cron jobs. Cron is a time-based job scheduler found in Unix and Linux systems, and cron-like scheduling is now used in cloud platforms, CI/CD pipelines, and container orchestrators.

The standard five-field format is:

* * * * *
| | | | |
| | | | +-- Day of week (0-7, 0 and 7 = Sunday)
| | | +---- Month (1-12)
| | +------ Day of month (1-31)
| +-------- Hour (0-23)
+---------- Minute (0-59)

Special Characters

  • * — every possible value (wildcard)
  • , — list separator (e.g., 1,15 for days 1 and 15)
  • - — range (e.g., 9-17 for hours 9 through 17)
  • / — step (e.g., */5 for every 5 units)
  • ? — "no specific value" (used in day-of-month or day-of-week in some systems)
  • L — last day of the month or last occurrence of a weekday (extended syntax)
  • W — nearest weekday to a given day (extended syntax)
  • # — nth weekday of the month, e.g., 2#1 = first Monday (extended syntax)

Common Cron Expression Examples

Run Every Minute

* * * * *

Triggers once every minute, 24/7. Useful for health checks or queue processing.

Run Every 5 Minutes

*/5 * * * *

Run Every Hour at Minute 0

0 * * * *

Run Daily at Midnight

0 0 * * *

Run Daily at 8:30 AM

30 8 * * *

Run Every Monday at 9 AM

0 9 * * 1

Run on the 1st and 15th of Every Month at Noon

0 12 1,15 * *

Run Weekdays at 6 PM

0 18 * * 1-5

Run Every 15 Minutes During Business Hours

*/15 9-17 * * 1-5

Run at Midnight on January 1st

0 0 1 1 *

Try It Now

Use our free Cron Expression Generator to build and validate cron schedules with a visual interface.

Cron Expression Generator →

Where Cron Expressions Are Used

  • Linux crontab — the original scheduler. Edit with crontab -e.
  • GitHub Actions — use schedule triggers with cron syntax.
  • AWS CloudWatch Events / EventBridge — schedules Lambda functions and ECS tasks.
  • Kubernetes CronJobs — runs containers on a cron schedule.
  • CI/CD pipelines — nightly builds, scheduled deploys, and periodic tests.

Debugging Tips

  1. Timezone matters. Cron usually runs in the server's timezone. Check with timedatectl on Linux or specify UTC explicitly.
  2. Test before deploying. Use a cron expression tool to see the next five execution times before committing your schedule.
  3. Log output. Redirect cron job output to a file: * * * * * /path/to/script >> /var/log/job.log 2>&1
  4. Avoid overlapping runs. If your job takes longer than the interval, use a lock file or flock.

Conclusion

Cron expressions are the standard way to define recurring schedules in software. Whether you are scheduling a database backup, a data pipeline, or a notification, mastering cron syntax saves time and prevents scheduling mistakes. Build your next schedule with our Cron Expression Generator.

Tools Mentioned in This Article