Cron Every 12 Hours

Run a cron job every 12 hours (twice daily) with 0 */12 * * *. Fires at midnight and noon.

The cron expression 0 */12 * * * runs a command every 12 hours starting at midnight, producing 2 executions per day. It triggers at 00:00, 12:00 (midnight, noon) daily. The minute field (0) controls the offset within each hour. Common use cases include periodic data synchronization, database replication checks, system health reports, cache invalidation, and batch processing pipelines that don't require minute-level frequency. Running every 12 hours balances data freshness with system load. For Quartz Scheduler, use 0 0/12 * ? * * (7 fields, seconds first, ? for day-of-week). For AWS EventBridge, use rate(12 hours) or cron(0 0/12 ? * * *). For Kubernetes CronJob, use schedule: "0 */12 * * *" directly. Note that */12 in the hour field starts from hour 0 (midnight). If you need a different starting hour, use explicit values: for example, 0 2,8,14,20 * * * runs every 6 hours starting at 2 AM instead of midnight. If you want this schedule only on weekdays, add the day-of-week field: 0 */12 * * 1-5. For business-hours-only variations, use an hour range like 0 9-17 * * 1-5.

FAQ

  • What does the cron expression 0 */12 * * * mean?

    The expression 0 */12 * * * means: at minute 0, hour */12, day-of-month *, month *, day-of-week *. Each field in the cron expression controls a different time component: minute, hour, day of month, month, and day of week.

  • How do I add 0 */12 * * * to my crontab?

    Run crontab -e in your terminal to open your crontab editor. Add a new line: 0 */12 * * * /path/to/your/script.sh. Save and exit. Verify with crontab -l. Make sure your script is executable (chmod +x script.sh) and uses full paths for all commands.

  • What is the equivalent of 0 */12 * * * on Quartz / AWS / Kubernetes?

    Quartz Scheduler: 0 */12 * * ?. AWS EventBridge: cron(0 */12 ? * * *). Kubernetes CronJob: schedule: "0 */12 * * *" (standard 5-field format). Each platform has slight syntax differences — use our dialect switcher above to get the exact expression.

  • Can I start the every-12-hours schedule at a different hour?

    Yes. */12 starts from hour 0 (midnight). To start from a different hour, use explicit comma-separated values. For example, to run every 12 hours starting at 3 AM: 0 3,15,27 * * *.

  • What are common mistakes when using 0 */12 * * *?

    Common pitfalls: (1) Cron uses a minimal PATH — always use full paths to commands and scripts. (2) Percent signs (%) must be escaped with backslash in crontab. (3) Cron runs in the system timezone — set CRON_TZ=UTC at the top of your crontab for consistent UTC scheduling. (4) Redirect output to prevent email spam: 0 */12 * * * /path/command >> /var/log/myjob.log 2>&1. (5) Test your cron expression with crontab.guru or our validator above before deploying.

  • Are there alternative cron expressions for this schedule?

    For a specific hour instead of interval: use comma-separated values like 0 0,8,16 * * *.

Platform Equivalents for 0 */12 * * *

The cron expression 0 */12 * * * has different syntax on various scheduling platforms. Here is the equivalent expression for each:

PlatformExpression
Unix / Linux crontab0 */12 * * *
Quartz Scheduler (Java)0 */12 * * ?
AWS EventBridgecron(0 */12 ? * * *)
Kubernetes CronJob0 */12 * * *
Vercel Cron0 */12 * * *
GitHub Actions0 */12 * * * (UTC)

Key differences across platforms: Quartz uses 7 fields starting with seconds and supports L (last) and W (weekday) modifiers. AWS EventBridge requires a 6th year field and uses ? instead of * in day fields when the other day field is specified. Kubernetes uses standard 5-field Unix cron. Vercel Cron uses the same format but schedules are defined in vercel.json. GitHub Actions uses standard cron but runs in UTC timezone only, so adjust the hour field for your local timezone offset.

Getting Started with Cron

Follow these tips when setting up cron jobs in production:

  • Always use full paths to commands and scripts in your crontab, since cron runs with a minimal PATH environment (often just /usr/bin:/bin).
  • Redirect output to log files: command >> /var/log/myjob.log 2>&1 to capture errors and prevent cron from emailing you every execution.
  • Test your cron expression before deploying — use our validator above or crontab.guru to verify the schedule fires when you expect.
  • Set MAILTO="" at the top of your crontab to disable email notifications, or set MAILTO=your@email.com to receive error alerts.
  • Use flock or a PID file to prevent overlapping executions for jobs that may take longer than their scheduled interval.