Cron every 6 months
The cron expression 0 0 1 1,7 * runs a job at 00:00, on the 1st of the month, in January and July. The next runs are 2027-01-01 00:00 and 2027-07-01 00:00 UTC. The shortest gap between runs is 181 days, so a heartbeat monitor with a 60-minute grace period catches a missed run.
| minute | hour | day of month | month | day of week |
|---|---|---|---|---|
| 0 | 0 | 1 | 1,7 | * |
Next runs (UTC)
- Fri 2027-01-01 00:00 UTC (+00:00) · in 80d 4h
- Thu 2027-07-01 00:00 UTC (+00:00) · in 261d 4h
- Sat 2028-01-01 00:00 UTC (+00:00) · in 445d 4h
- Sat 2028-07-01 00:00 UTC (+00:00) · in 627d 4h
- Mon 2029-01-01 00:00 UTC (+00:00) · in 811d 4h
- Sun 2029-07-01 00:00 UTC (+00:00) · in 992d 4h
- Tue 2030-01-01 00:00 UTC (+00:00) · in 1176d 4h
- Mon 2030-07-01 00:00 UTC (+00:00) · in 1357d 4h
- Wed 2031-01-01 00:00 UTC (+00:00) · in 1541d 4h
- Tue 2031-07-01 00:00 UTC (+00:00) · in 1722d 4h
Notes for this schedule
A straightforward schedule. The general pitfalls below still apply.
Examples
0 0 1 1,7 * /usr/local/bin/my-job.sh && curl -fsS -m 10 --retry 3 -o /dev/null https://puzaricloud.in/ping/<your-token>
# /etc/systemd/system/my-job.timer [Unit] Description=Run my-job (every 6 months) [Timer] OnCalendar=*-01,07-01 00:00:00 Persistent=true [Install] WantedBy=timers.target
# /etc/systemd/system/my-job.service [Unit] Description=my-job [Service] Type=oneshot ExecStart=/usr/local/bin/my-job.sh # runs only if ExecStart succeeded ExecStartPost=/usr/bin/curl -fsS -m 10 --retry 3 -o /dev/null https://puzaricloud.in/ping/<your-token>
Check the calendar spec with systemd-analyze calendar "*-01,07-01 00:00:00", then systemctl enable --now my-job.timer. Persistent=true runs a missed job at boot.
apiVersion: batch/v1
kind: CronJob
metadata:
name: my-job
spec:
schedule: "0 0 1 1,7 *"
timeZone: "Etc/UTC" # Kubernetes 1.27+; otherwise the controller's timezone
concurrencyPolicy: Forbid # don't start a new run while one is active
startingDeadlineSeconds: 300 # still start if the controller was briefly down
jobTemplate:
spec:
backoffLimit: 2
template:
spec:
restartPolicy: OnFailure
containers:
- name: job
image: your-image:tag
command: ["/bin/sh", "-c", "/app/run-job.sh && curl -fsS -m 10 --retry 3 -o /dev/null https://puzaricloud.in/ping/<your-token>"]
on:
schedule:
- cron: "0 0 1 1,7 *" # always evaluated in UTC
workflow_dispatch: {} # lets you run it by hand too
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./run-job.sh
- name: Tell Vigil the job ran
if: success()
run: curl -fsS -m 10 --retry 3 -o /dev/null https://puzaricloud.in/ping/${{ secrets.VIGIL_PING_TOKEN }}
GitHub runs schedules in UTC, can delay them at busy times, and disables scheduled workflows in public repos after 60 days without activity.
Common mistakes
timedatectl or date. cronie (RHEL, Fedora, Arch) accepts CRON_TZ=Asia/Kolkata at the top of a crontab; Debian/Ubuntu cron does not.0 0 13 * 5 runs on every 13th and every Friday, not only on Friday the 13th.% is turned into a newline (everything after it goes to the command's stdin). Write date +\%F, not date +%F.PATH (often just /usr/bin:/bin), no login shell and no .bashrc. Use absolute paths and set variables at the top of the crontab.How to get alerted when it doesn't run
A cron job that stops running looks exactly like one that's working: no errors, no output. The reliable fix is a heartbeat (dead man's switch): the job pings a URL each time it finishes, and the monitor alerts you when a ping is late.
- Create a heartbeat in Vigil and choose cron schedule: 0 0 1 1,7 *, timezone of your server.
- Set a grace period of about 60 minutes: long enough for a normal run to finish, short enough that you hear about it quickly.
- Add the ping to the end of the command (above). && means only successful runs ping; use /ping/<token>/$? to report the exit code, and /start to catch jobs that hang.
Vigil tells you when a run is missed
Vigil heartbeats understand cron expressions and timezones, so they know exactly when each run is due. Missed, failed or stuck runs alert you on email, Slack, Telegram, Discord or a webhook, and the history shows every run's duration.