Devtools.supstudio.in

Tools/Cron

Kubernetes cron

A Kubernetes CronJob uses spec.schedule with the same 5-field layout as crontab. From 1.27 you can set spec.timeZone to an IANA name so the controller is not stuck in the API server's zone.

Field format

minute hour day-of-month month day-of-week

Open the builder

Gotchas

Does Kubernetes cron run in UTC?
By default it uses the timezone of kube-controller-manager. Set spec.timeZone: America/New_York (or your zone) for predictable hours.
What if a previous job is still running?
concurrencyPolicy defaults to Allow. Use Forbid to skip an overlapping tick, or Replace to kill the old job.

Examples

Snippet for Kubernetes

GitHub Actions

UTC only. Quote the expression so YAML keeps the stars.

on:
  schedule:
    - cron: '0 9 * * 1'

Kubernetes

CronJob spec.schedule. Kubernetes uses the timezone of the kube-controller-manager unless you set .spec.timeZone.

apiVersion: batch/v1
kind: CronJob
metadata:
  name: job
spec:
  schedule: "0 9 * * 1"
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: OnFailure
          containers:
            - name: job
              image: busybox
              args: ["echo", "run"]

AWS EventBridge

Six fields: minutes hours day-of-month month day-of-week year. Use ? in either day-of-month or day-of-week.

cron(0 9 ? * 1 *)

Quartz

Quartz is seconds-first (6 or 7 fields). Day-of-week names are MON, TUE, … and ? is required in one of the day fields.

0 0 9 * * 1

Vercel Cron

{
  "crons": [
    {
      "path": "/api/cron",
      "schedule": "0 9 * * 1"
    }
  ]
}

crontab

0 9 * * 1 /usr/local/bin/job

node-cron

import cron from 'node-cron';

cron.schedule('0 9 * * 1', () => {
  // job
});

Spring @Scheduled

Spring uses 6 fields by default (seconds first) unless you set spring.task.scheduling.cron.expression.

@Scheduled(cron = "0 0 9 * * 1")
public void run() {
    // job
}

Useful schedules

Other platforms