CRON Calculator
What is CRON and what is it for?
CRON is a Unix daemon that automatically executes commands or scripts at specific intervals. It is essential for automating repetitive tasks like backups, log rotation, updates, and more. With a CRON calculator you can translate any CRON expression to plain English and verify that your CRON jobs run at the exact time you need.
CRON Expression Format
A CRON expression has 5 fields separated by spaces:
┌─────────────── minute (0 - 59)
│ ┌─────────────── hour (0 - 23)
│ │ ┌─────────────── day of month (1 - 31)
│ │ │ ┌─────────────── month (1 - 12)
│ │ │ │ ┌─────────────── day of week (0 - 6)
│ │ │ │ │
* * * * *
Special Characters
- * - Any value
- , - List of values (1,3,5)
- - - Range of values (1-5)
- / - Step (* /5 every 5 minutes)
Common Examples
- 0 * * * * - Every hour
- 0 0 * * * - Every day at midnight
- 0 0 * * 0 - Every Sunday at midnight
- 0 */6 * * * - Every 6 hours
- 30 4 1,15 * * - At 4:30 on days 1 and 15 of each month
How to use this CRON calculator
Follow these three steps to calculate CRON expressions and get plain English descriptions:
- Enter the CRON expression
Type your 5-field CRON expression in the main input field or use the individual selectors (minute, hour, day of month, month, day of week) to build it field by field. You can also pick one of the predefined examples to get started quickly.
- Read the plain English description
The calculator will automatically convert your CRON expression to plain English, telling you exactly when it will run. You will also see the next 5 execution dates and times to confirm the schedule is correct.
- Copy and add to your crontab
Once the expression is correct, use the "Copy" button to save it to your clipboard. Then run
crontab -ein your Linux terminal and paste the expression along with the command you want to schedule.
With this free CRON calculator you can validate any expression before adding it to your crontab, avoiding syntax errors that could prevent your scheduled tasks from executing.
Real CRON use cases
CRON is used in production environments to automate all kinds of system administration tasks. Here are some of the most common CRON use cases:
- Automated backups: Schedule daily or weekly backups of databases and critical files. For example,
0 2 * * *runs a backup script every night at 2:00 AM when server load is lower. This is one of the most common CRON jobs on any production server. - Log rotation: Log files can grow quickly and fill the disk. With CRON you can run logrotate or custom scripts to compress and rotate logs periodically:
0 0 * * 0 /usr/sbin/logrotate /etc/logrotate.conf. - Temporary cache cleanup: Delete temporary files and caches that are no longer needed. A task like
0 4 * * * find /tmp -type f -atime +7 -deletecleans files in /tmp older than 7 days. - Scheduled report delivery: Generate and send reports via email automatically. For instance, a weekly sales summary every Monday at 8:00 AM with the expression
0 8 * * 1 /scripts/weekly-report.sh. - Server synchronization: Keep directories synchronized across multiple servers using rsync. A CRON expression like
0 * * * * rsync -avz /data/ user@server:/backup/replicates data hourly. - SSL certificate renewal: Certbot can run automatically with CRON to renew Let's Encrypt certificates before they expire:
0 0 * * * certbot renew --quiet. - Service monitoring: Healthcheck scripts that verify critical services are running and restart them if needed. For example, every 5 minutes:
*/5 * * * * /scripts/healthcheck-nginx.sh.
These are just a few examples of how to schedule Linux tasks with CRON. You can use our calculator to build and verify any expression before putting it into production.
CRON best practices
To avoid issues and ensure your CRON jobs run reliably, follow these CRON best practices:
- Redirect output to a log file
By default, CRON emails any output to the user. It is better to redirect stdout and stderr to a log file for review:
*/5 * * * * /usr/local/bin/script.sh >> /var/log/script.log 2>&1
- Always use absolute paths
CRON runs commands with a minimal PATH (/usr/bin:/bin). If your script uses tools in /usr/local/bin, you must specify the full path or configure PATH in the crontab:
30 2 * * * /usr/bin/python3 /home/user/scripts/cleanup.py
- Do not assume environment variables
CRON does not load user profile files (.bashrc, .bash_profile). If your script needs environment variables, define them within the script or at the top of the crontab:
- Schedule heavy tasks during off-peak hours
Run backups, updates, and intensive processes between 2:00 AM and 5:00 AM when server usage is minimal. Avoid scheduling heavy tasks during peak hours to prevent impact on application performance.
- Use descriptive comments in crontab
Document each task with comments explaining what it does, who created it, and when. A well-documented crontab makes long-term maintenance much easier:
# Nightly database backup - 2:30 AM
30 2 * * * /scripts/backup-db.sh
- Monitor job execution
Implement logging and alerting. Have your scripts notify on failure using MAILTO or integrate with monitoring tools like Nagios, Datadog, Prometheus, or simply review logs periodically with grep.
- Use the correct 5-field syntax
Standard CRON syntax uses 5 fields. Do not confuse it with special keywords like @reboot, @daily, or @weekly, which are extensions in some systems (Vixie cron, cronie) and are not part of the POSIX standard. If you need portability across systems, always use the 5-field syntax and verify it with a CRON expression calculator.
Following these CRON best practices will help you maintain a stable system and avoid tasks that do not run as expected. Use our calculator to validate each expression before putting it into production.
Frequently asked questions about CRON
What does each field in a CRON expression mean?
A CRON expression has 5 fields: minute (0-59), hour (0-23), day of month (1-31), month (1-12), day of week (0-6, where 0=Sunday). For example, "30 4 * * 1-5" means "at 4:30 AM, Monday through Friday". Use our free CRON calculator to translate any expression to plain English instantly.
How to schedule a task every hour with CRON?
To run a task every hour, use the expression "0 * * * *". This runs the command at minute 0 of every hour, every day. For every 30 minutes use "*/30 * * * *", and for every 15 minutes "*/15 * * * *". Our CRON calculator helps you visualize these expressions and check the next execution dates.
What is the difference between CRON and Crontab?
CRON is the system daemon that executes scheduled tasks. Crontab is the configuration file (and the command to edit it) where you define your tasks. Each user has their own crontab. Edit with "crontab -e" and list tasks with "crontab -l". Always validate your expressions with a CRON calculator before adding them to your crontab.
How to make a script run every day at midnight?
Use the expression "0 0 * * *". The first 0 is the minute, the second 0 is the hour (midnight = 00:00), and the three asterisks mean "every day, every month, every day of the week". To schedule Linux tasks at other specific times, use our CRON calculator to find the right expression.
What do @reboot, @daily, @weekly mean in CRON?
@reboot runs the task once when the system starts. @daily (equivalent to 0 0 * * *) runs the task once a day at midnight. @weekly (0 0 * * 0) runs it every Sunday at midnight. @monthly (0 0 1 * *) on the first day of each month. @yearly (0 0 1 1 *) runs on January 1st. These keywords are supported by most modern Linux systems (Vixie cron, cronie) but are not part of the POSIX standard, so use the 5-field syntax if you need portability.
How do I know if my CRON job ran successfully?
You can check execution by reviewing system logs. On most Linux distributions, CRON logs are located in /var/log/syslog or /var/log/cron. Run "grep CRON /var/log/syslog" to see recent executions. You can also redirect your script output to a custom log file by adding ">> /var/log/mytask.log 2>&1" at the end of the command, and configure MAILTO in your crontab to receive email notifications on errors.
Can I schedule a task every 30 seconds with CRON?
No, CRON has a minimum resolution of 1 minute. It is not possible to schedule tasks at sub-minute intervals with standard CRON. As an alternative, you can use a loop with sleep inside your script: "while true; do command; sleep 30; done", or use systemd timers which support more precise time units. Another option is using "sleep 30 && command" combined with a CRON job running every minute.
Does CRON work on Windows?
No, CRON is a native Unix/Linux tool. Windows does not include CRON, but offers alternatives like Windows Task Scheduler, which allows scheduling tasks with a graphical interface and advanced triggers. You can also use PowerShell with ScheduledJobs, or install third-party solutions like Cron for Windows or Cygwin if you prefer CRON syntax. In WSL (Windows Subsystem for Linux) environments, CRON works within the installed Linux distribution.
Related Tools
Server Name Generator
Generate consistent server names (prod-web-01, staging-db-01)
sysctl Optimizer
Generate optimized sysctl config for your server
Log Retention Calculator
Calculate how long logs will last on disk
Logrotate Generator
Generate configurations for the logrotate daemon. Prevent logs from filling your disk.