Skip to content
UtilHQ

Cron Job Generator

Cron jobs are the backbone of task automation in Unix-like operating systems.

100% Free No Data Stored Instant

Cron Expression

* * * * *

Human Readable

Every minute

Next 5 Scheduled Runs

  • 1. Thu, Feb 26, 2026, 6:41 AM
  • 2. Thu, Feb 26, 2026, 6:42 AM
  • 3. Thu, Feb 26, 2026, 6:43 AM
  • 4. Thu, Feb 26, 2026, 6:44 AM
  • 5. Thu, Feb 26, 2026, 6:45 AM

Cron Format Reference

* * * * *

  • 1. Minute (0-59)
  • 2. Hour (0-23)
  • 3. Day of Month (1-31)
  • 4. Month (1-12)
  • 5. Day of Week (0-6, Sunday=0)

Special Characters: * = every, */n = every n units, , = list, - = range

Pro Tip: Always test your cron expressions in a staging environment first. Use */5 * * * * (every 5 minutes) for testing instead of * * * * *to avoid overwhelming your system with every-minute executions. Remember that cron uses your system's local timezone - verify it matches your expectations with date or timedatectl.

Ad Space
Ad Space

Share this tool

About This Tool

Cron jobs are the backbone of task automation in Unix-like operating systems. Running backups at midnight, sending weekly reports, rotating log files, or cleaning up temporary directories every hour all depend on cron expressions to schedule execution with precision. The five-field cron syntax has been the standard for decades across Linux servers, macOS systems, cloud platforms like AWS and Google Cloud, and container orchestration tools like Kubernetes. However, cron syntax can be cryptic and error-prone. A single misplaced asterisk or wrong field value can cause your backup to run every minute instead of every day, potentially overwhelming your system or missing critical maintenance windows. This free cron generator helps you build cron expressions visually, understand existing schedules, and verify when your jobs will actually run. Select your desired schedule from the dropdowns, and instantly see the cron expression, a human-readable explanation, and the next five execution times. Switch between platform-specific formats for AWS EventBridge, Kubernetes CronJobs, GitHub Actions, and systemd timers. No more debugging why your job ran at 2 AM instead of 2 PM. Perfect for developers, DevOps engineers, and system administrators who work with scheduled tasks regularly.

What is a Cron Expression?

A cron expression is a string of five (or six, in some systems) fields that define when a scheduled task should execute. Developed in the 1970s for Unix systems, cron has become the universal standard for task scheduling across Linux, macOS, and even cloud platforms like AWS and Google Cloud.

The five fields represent:

  • Minute (0-59): The minute of the hour when the job runs
  • Hour (0-23): The hour of the day in 24-hour format
  • Day of Month (1-31): Which day of the month
  • Month (1-12): Which month of the year
  • Day of Week (0-6): Which day of the week (0 = Sunday)

For example, 0 2 * * * means "run at 2:00 AM every day," while */15 * * * * means "run every 15 minutes." The asterisk (*) is a wildcard meaning "every" or "any value."

This tool eliminates the guesswork by letting you build expressions visually and immediately see when they'll execute.

Common Cron Expression Patterns

Here are the most commonly used cron patterns and what they mean:

  • * * * * * - Every minute (use cautiously!)
  • */5 * * * * - Every 5 minutes
  • 0 * * * * - Every hour at minute 0
  • 0 0 * * * - Daily at midnight
  • 0 2 * * * - Daily at 2:00 AM (common for backups)
  • 0 9 * * 1 - Every Monday at 9:00 AM
  • 0 0 1 * * - First day of every month at midnight
  • 0 0 * * 0 - Every Sunday at midnight
  • */30 9-17 * * 1-5 - Every 30 minutes during business hours (9 AM - 5 PM) on weekdays

Backups: Most production backups run at 0 2 * * * (2 AM) when server load is lowest.

Reports: Weekly reports often use 0 9 * * 1 (Monday 9 AM) to summarize the previous week.

Cleanup: Temporary file cleanup might run 0 */6 * * * (every 6 hours) to prevent disk fill-up.

How to Use Cron in Different Environments

Linux/macOS (crontab):

Edit your user's crontab with crontab -e, then add your cron expression followed by the command:

0 2 * * * /path/to/backup-script.sh

List current jobs: crontab -l

AWS CloudWatch Events / EventBridge:

AWS uses cron expressions with an additional sixth field for seconds. For example:

cron(0 2 * * ? *) - runs daily at 2 AM (the ? in day-of-week means "no specific value")

Kubernetes CronJobs:

In Kubernetes manifests, use standard 5-field cron syntax:

apiVersion: batch/v1
kind: CronJob
metadata:
  name: backup-job
spec:
  schedule: "0 2 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: backup
            image: backup-image:latest

GitHub Actions:

Schedule workflows using cron syntax in your YAML:

on:
  schedule:
    - cron: '0 2 * * *'

Each platform may have slight syntax variations, but the core 5-field pattern remains consistent.

Debugging Cron Jobs: Common Pitfalls

1. Time Zone Issues: Cron uses the server's local time zone, not UTC. If your server is in US Eastern (EST/EDT), 0 2 * * * runs at 2 AM Eastern, which is 7 AM UTC. Always verify your server's timezone with date or timedatectl.

2. PATH Environment: Cron jobs run with a minimal environment. Commands like npm, python, or git may not be in PATH. Always use absolute paths:

0 2 * * * /usr/bin/python3 /home/user/script.py

3. No Standard Output: Cron doesn't show output unless you redirect it. Append >> /var/log/cron.log 2>&1 to capture both stdout and stderr:

0 2 * * * /path/to/script.sh >> /var/log/backup.log 2>&1

4. Overlapping Jobs: If a job takes longer than its interval, it can overlap with the next execution. Use flock or similar locking mechanisms to prevent this.

5. Day-of-Month vs Day-of-Week: When both are specified (not *), the job runs when EITHER condition is met (OR logic, not AND). This often surprises users.

Testing Tip: Instead of waiting for your job to run, test the command manually first by copying it from your crontab and running it in your shell. This reveals PATH and permission issues immediately.

Security Best Practices for Cron Jobs

Cron jobs run with the privileges of the user who created them, making security an important consideration:

  • Least privilege: Create a dedicated service account for cron jobs instead of running them as root. This limits the damage if a script is compromised or has a bug.
  • Script permissions: Set restrictive file permissions on cron scripts (chmod 700). Ensure only the owner can read, write, and execute them to prevent tampering.
  • Avoid storing credentials in scripts: Use environment variables, secret managers (like AWS Secrets Manager or HashiCorp Vault), or restricted configuration files instead of hardcoding passwords in cron scripts.
  • Log and monitor: Send cron job output to log files and set up alerts for failures. Tools like cronitor.io or healthchecks.io can notify you when scheduled jobs stop running.
  • Validate inputs: If your cron job processes external data (files, API responses), validate the input before acting on it. A corrupted data file should not cause your script to delete production data.

Regular audits of your crontab entries help identify stale or unnecessary jobs. Run crontab -l periodically and remove any jobs that are no longer needed.

Frequently Asked Questions

What does */5 mean in a cron expression?
The */5 syntax means "every 5 units." In the minute field, */5 means "every 5 minutes" (runs at :00, :05, :10, :15, etc.). In the hour field, */5 means "every 5 hours." The asterisk represents "every value," and dividing by 5 selects every fifth occurrence. This is called a "step value" in cron terminology.
Why is my cron job not running?
Common reasons cron jobs fail to run:
  • The cron daemon (crond) is not running - check with "systemctl status cron" or "ps aux | grep cron"
  • Syntax errors in your crontab - use "crontab -l" to verify your expression is saved correctly
  • Permissions - the script must be executable (chmod +x script.sh)
  • PATH issues - cron uses a limited PATH, so use absolute paths to commands
  • Output redirection - add ">> /tmp/cron.log 2>&1" to your command to see error messages
What is the difference between 0 0 * * 0 and 0 0 * * 7?
Both represent Sunday, but "0" is the standard POSIX value while "7" is a non-standard extension supported by some cron implementations (like Vixie cron on Linux). For maximum compatibility, always use "0" for Sunday. Some systems accept both, while others only recognize 0-6 where 0=Sunday, 1=Monday, through 6=Saturday.
How do I run a cron job every weekday at 9 AM?
Use the expression "0 9 * * 1-5". This breaks down as: 0 (minute 0), 9 (9 AM), * (every day of month), * (every month), 1-5 (Monday through Friday). The day-of-week field uses ranges, where 1-5 represents the weekday range. This is perfect for business-hours automation like sending daily reports or running builds.
Can I run a cron job every 90 minutes?
Not with a single simple cron expression. Cron step values (*/n) only work within a single field. For 90 minutes, you would need multiple entries: "0 0,1,3,4,6,7,9,10,12,13,15,16,18,19,21,22 * * *" and "30 0,1,3,4,6,7,9,10,12,13,15,16,18,19,21,22 * * *". For complex intervals, consider using a task scheduler like systemd timers or writing a script that sleeps for 90 minutes and re-runs itself.
What timezone does cron use?
Cron uses the system's local timezone, NOT UTC. If your server is in New York (EST/EDT), "0 2 * * *" runs at 2 AM Eastern Time. To check your system timezone, run "date" or "timedatectl". To change it, use "timedatectl set-timezone America/New_York". Some cloud cron services (like AWS CloudWatch) use UTC by default - always verify the documentation for your specific platform.
U

Reviewed by the UtilHQ Team

Our tools are verified for accuracy. Results are estimates for planning purposes.