T
ToolPrime

Cron Expression for Every 12 Hours

Run a cron job every 12 hours (twice daily) using 0 */12 * * *. Great for morning/evening batch jobs and digest emails.

Expression

0 */12 * * *

Every 12 hours at minute 0

Use Cases

Code Examples

Crontab

# Every 12 hours at minute 0
0 */12 * * * /path/to/your/script.sh

GitHub Actions

name: Scheduled Job
on:
  schedule:
    - cron: '0 */12 * * *'
jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: echo "Running Every 12 Hours"

systemd Timer

[Unit]
Description=Every 12 Hours timer

[Timer]
OnCalendar=*-*-* *:*:00
Persistent=true

[Install]
WantedBy=timers.target

Tips

Frequently Asked Questions

Is 0 */12 * * * the same as 0 0,12 * * *?

Yes, both run at midnight (0:00) and noon (12:00). The */12 divides 24 hours into two 12-hour intervals.

How do I run twice a day at specific times?

Use 0 H1,H2 * * * where H1 and H2 are the hours you want. For example, 0 8,20 * * * runs at 8 AM and 8 PM.

Related Cron Expressions