Cron Job Generator & Explainer
A powerful tool to generate, parse, and understand cron job schedules. Create any cron expression with our intuitive visual editor, or paste a cron string to get a human-readable explanation.
Your Full Crontab Command
Explanation
At every minute.
What is a Cron Job? A Deep Dive
A cron job is a powerful automation tool for developers and system administrators using Linux or other Unix-like operating systems. It's a "time-based job scheduler," which is a technical way of saying it runs commands or scripts automatically at a specified time and date. Think of it as an alarm clock for your server that can perform tasks without any manual intervention.
The schedule for these jobs is defined using a special format called a cron expression. While incredibly powerful, this syntax can be cryptic and difficult to remember (e.g., `15 2 * * 1-5`
). That's where our Cron Job Generator comes in. It provides a simple, error-free way to create these expressions and even helps you understand existing ones with its parsing feature.
Popular Cron Job Examples
Need a common schedule? Here are some of the most frequently used cron expressions. Click on any example to load it into the generator.
Intervals (Minutes & Hours)
- * * * * *Every Minute
- */5 * * * *Every 5 Minutes
- */15 * * * *Every 15 Minutes
- 0 * * * *Every Hour
- 0 */2 * * *Every 2 Hours
- 0 */6 * * *Every 6 Hours
Daily Schedules
- 0 0 * * *Every Day at Midnight
- 0 9 * * *Every Day at 9:00 AM
- 0 12 * * *Every Day at Noon
- 30 2 * * *Every Day at 2:30 AM
- 0 18 * * *Every Day at 6:00 PM
Weekly Schedules
- 0 0 * * 0Every Sunday at Midnight
- 0 9 * * 1Every Monday at 9:00 AM
- 0 18 * * 5Every Friday at 6:00 PM
- 0 9 * * 1-5Weekdays at 9:00 AM
- 0 0 * * 6,0Weekends at Midnight
Monthly & Yearly
- 0 0 1 * *1st of Every Month at Midnight
- 0 9 1 * *1st of Every Month at 9:00 AM
- 0 0 15 * *15th of Every Month at Midnight
- 0 0 1 1 *New Year's Day at Midnight
Understanding Cron Expression Syntax
A cron expression is composed of five fields, separated by spaces, that represent a specific time. A sixth field (the command to run) is added after the expression. Here’s a breakdown of each part:
Field | Allowed Values | Description |
---|---|---|
minute | 0-59 | The minute of the hour the command will run. |
hour | 0-23 | The hour of the day (in 24-hour format). |
day-of-month | 1-31 | The specific day of the month. |
month | 1-12 | The month of the year. |
day-of-week | 0-6 | The day of the week (where Sunday is 0). |
Decoding Special Characters
To make cron expressions flexible, you can use several special characters:
- * (Asterisk): The "wildcard" character. It means "every" or "all." For example, an asterisk in the `hour` field means the job will run every hour.
- , (Comma): The "list" operator. It specifies a list of values. For example, `1,15,30` in the `minute` field will run the job at 1, 15, and 30 minutes past the hour.
- - (Hyphen): The "range" operator. It defines a range of values. For example, `9-17` in the `hour` field means the job will run every hour from 9 AM to 5 PM.
- / (Slash): The "step" operator. It is used with the asterisk to specify increments. For example, `*/15` in the `minute` field means "every 15 minutes."
Examples & Common Use Cases
Cron jobs are the backbone of automation. Here are some practical examples with full commands you can adapt:
Automated Daily Database Backup
This command runs a MySQL database backup every day at 2:30 AM.
30 2 * * * mysqldump -u user -p'password' db_name | gzip > /path/to/backups/db_$(date +\%F).sql.gz
Run a PHP Script Every 15 Minutes
Useful for tasks that need to run frequently, like checking for new orders.
*/15 * * * * /usr/bin/php /var/www/html/your_script.php
Clear Cache Weekly
This runs at 4:00 AM every Sunday to clear a temporary cache directory.
0 4 * * 0 rm -rf /path/to/your/cache/*
Send a Report Email on Weekdays
This command uses `curl` to trigger an API endpoint that sends a report every weekday at 9:00 AM.
0 9 * * 1-5 curl -X POST https://api.example.com/send-report