Cron every 12 hours
The cron expression for every 12 hours is 0 */12 * * *. In words: on the hour, every 12 hours.
What each field means
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 | minute 0 |
| Hour | */12 | every 12 hours |
| Day of month | * | any day of the month |
| Month | * | every month |
| Day of week | * | any day of the week |
Times are in the timezone of whatever runs the schedule: the server's local time for crontab, UTC for GitHub Actions.
Use it
In a crontab, with a FlatLyne ping after the job succeeds:
0 */12 * * * /usr/local/bin/job.sh && curl -fsS -m 10 --retry 5 https://api.flatlyne.com/<ping-token>
In a Kubernetes CronJob:
apiVersion: batch/v1 kind: CronJob spec: schedule: "0 */12 * * *" timeZone: "Etc/UTC"
In a GitHub Actions workflow (always UTC):
on:
schedule:
- cron: "0 */12 * * *"Know when it doesn't run
Cron doesn't tell you when a job fails or never starts. Create a FlatLyne check with the schedule 0 */12 * * *, add the curl above to your job, and get an email, Slack message or PagerDuty incident when a ping is late. See how to monitor a cron job.
Related schedules
- Cron every hour 0 * * * *
- Cron every 2 hours 0 */2 * * *
- Cron every 3 hours 0 */3 * * *
- Cron every 4 hours 0 */4 * * *
- Cron every 6 hours 0 */6 * * *
- Cron every 8 hours 0 */8 * * *
- Cron every hour during business hours 0 9-17 * * 1-5
Have a different expression? Paste it into the cron expression tool, or browse all examples.