Run a Cron Job Every 12 Hours

Runs every 12 hours (twice per day at midnight and noon).

crontab -e
0*/12***
$0 */12 * * *

Field Breakdown

0

Minute

0–59

*/12

Hour

0–23

*

Day of Month

1–31

*

Month

1–12

*

Day of Week

0–6

How It Works

With 0 */12 * * *, the job runs at 00:00 and 12:00 each day. A twice-daily schedule suits tasks like database backups, digest emails, and daily summaries that benefit from a mid-day checkpoint. Running at both midnight and noon provides natural breakpoints for AM and PM processing cycles.

Setting the minute to 0 and the hour to */12 creates matches at hour 0 (midnight) and hour 12 (noon). The step of 12 starting from 0 only produces two values within the 0–23 range. This results in exactly two executions per day, evenly spaced 12 hours apart.

Platform Usage

Linux: "0 */12 * * * pg_dump mydb > /backups/db-$(date +\%Y\%m\%d-\%H).sql". In GitHub Actions, use two separate cron triggers for finer control: "cron: '0 0 * * *'" and "cron: '0 12 * * *'". AWS EventBridge: "cron(0 0/12 * * ? *)" (note AWS cron uses ? for day fields).

Common Use Cases

1

Running database backups twice daily

2

Sending AM/PM summary digests

3

Refreshing API tokens with 24h expiry

4

Triggering CI/CD nightly + midday builds

try-it

$ crongen --customize "0 */12 * * *"

Want to tweak this schedule or see the next run times?

Open in Generator

Related Examples