Loading...
Loading...
Free online cron expression generator — build, preview and validate cron schedules for DevOps, backups, and automation tasks. Supports presets and next execution times.
Every 5 minutes
Presets:
Next Executions:
A Cron expression is a string of five fields that define a time-based task schedule in Unix-like operating systems. Each field represents a specific time unit: minute (0-59), hour (0-23), day of month (1-31), month (1-12), and day of week (0-7, where both 0 and 7 represent Sunday). An asterisk (*) in any field means 'every possible value' for that time unit.
Cron tasks are the backbone of server automation. They handle everything from log rotation and temp directory cleanup to database backups, scheduled email sends, and CI/CD pipeline triggers. Almost every production system relies on cron to perform routine maintenance that must happen without human intervention.
The syntax can seem cryptic at first, but it follows a consistent logic. For example, the expression 0 5 * * * means 'run at 5:00 AM every day'. The expression */15 * * * * means 'run every 15 minutes'. More complex schedules combine multiple fields: 0 9 * * 1-5 means 'every weekday at 9 AM', while 0 0 1 * * means 'midnight on the first day of every month'.
Beyond the basic five-field syntax, some cron implementations support extensions like @yearly, @monthly, @weekly, @daily, @hourly, and @reboot. However, these are not portable across all systems. The standard five-field format works everywhere and is what this generator produces.
A common pitfall is timezone handling. Cron uses the server's system timezone, which might differ from your local timezone. If you schedule a task for midnight but the server uses UTC while you are in UTC+8, the task will run at 8 AM your local time. Always verify the server's timezone when setting up cron tasks.
Another important consideration is execution overlap. If a cron task takes longer than its interval (e.g., a backup that runs every hour but takes 70 minutes), a second instance will start before the first finishes. Use file locks or task coordination tools like flock to prevent conflicts.
The */5 syntax means 'every 5 units'. In the minute field, */5 means the task runs every 5 minutes — at :00, :05, :10, and so on. This is called a step value and works with any of the five fields.
Use the expression 0 9 * * 1-5. This means minute 0, hour 9, any day of month, any month, Monday through Friday (1-5). Using 1-5 for the weekday field is more explicit and portable than using 0-4 or 1-5 depending on your cron implementation.
Common reasons include: (1) missing or extra spaces between fields — must be exactly 5 fields separated by single spaces, (2) using 7 for Sunday — both 0 and 7 represent Sunday in most implementations, (3) forgetting that cron uses the server's timezone, and (4) the user running the cron job doesn't have the necessary permissions.
Standard cron cannot run tasks more frequently than every minute. For sub-minute intervals, use a loop with sleep inside a script, or use systemd timers with the OnCalendar= option that supports second-level precision.
Cron is the system daemon that executes scheduled tasks. Crontab is the file format used to define schedules. A cron job is a single scheduled task defined by one line in a crontab file.