Start free · Free tools · Fair usage limits
Browse Tools

Categories

Custom AI Solutions – AI2Flows
LIVE NEWS
Loading latest AI & SEO news…
Home›Tools›Crontab Builder›How to run a cron job every 30 seconds
Cron expression

How to run a cron job every 30 seconds

How to schedule a cron job every 30 seconds: why one expression isn’t enough, a copy-ready crontab workaround, and next run times.

Quick answer

Standard cron cannot run a job every 30 seconds with one plain expression. Cron’s smallest unit is one minute. The usual fix is 2 crontab lines, shown below, which you can copy straight into crontab -e.

Last updated · Maintained by FreeAIToolz · How we test

Every minute

Open in the full Crontab Builder →

Copy-ready crontab to run a job every 30 seconds

* * * * * /path/to/command
* * * * * sleep 30; /path/to/command

The first line runs at :00 and the second at :30 of every minute.

What does * * * * * mean?

Every minute. This is the base schedule used by the workaround above.

FieldValueAllowedMeaning
Minute*0–59every minute
Hour*0–23every hour
Day of month*1–31every day of month
Month*1–12every month
Day of week*0–6 (0 = Sunday)every day of week

Example run times

If the current time were Monday 4 January 2027, 08:58 UTC, * * * * * would next run at:

  1. Mon 4 Jan 2027, 08:59 UTC
  2. Mon 4 Jan 2027, 09:00 UTC
  3. Mon 4 Jan 2027, 09:01 UTC
  4. Mon 4 Jan 2027, 09:02 UTC
  5. Mon 4 Jan 2027, 09:03 UTC
  6. Mon 4 Jan 2027, 09:04 UTC

When to use a cron job every 30 seconds

High-frequency polling where a minute is too slow.

Things to watch out for

Cron’s smallest unit is one minute. To run twice a minute, add two entries, one delayed by 30 seconds. For sub-minute schedules, a systemd timer or a long-running worker loop is usually better.

How to use this schedule in your scheduler

This schedule needs 2 separate entries. Schedulers that accept a list (GitHub Actions) take them all; for Kubernetes or EventBridge, create one schedule per line.

Linux crontab

Run crontab -e and add:

* * * * * /path/to/command
* * * * * sleep 30; /path/to/command

GitHub Actions

on:
  schedule:
    - cron: '* * * * *'
    - cron: '* * * * *'   # UTC

GitHub Actions runs scheduled workflows at most once every 5 minutes, and runs can be delayed at busy times.

Kubernetes CronJob

apiVersion: batch/v1
kind: CronJob
metadata:
  name: my-job
spec:
  schedule: "* * * * *"
  timeZone: "Etc/UTC"
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: OnFailure
          containers:
            - name: job
              image: busybox
              command: ["sh", "-c", "echo run"]

AWS EventBridge Scheduler

EventBridge uses six fields (with a year) and needs ? in either day-of-month or day-of-week:

cron(* * * * ? *)

Spring @Scheduled (seconds first)

@Scheduled(cron = "0 * * * * *", zone = "UTC")

Node.js (node-cron)

cron.schedule('* * * * *', () => { /* job */ }, { timezone: 'UTC' });

Vercel Cron Jobs (vercel.json)

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

Vercel cron jobs run in UTC, and how often they can run depends on your plan.

More cron schedules

Frequently asked questions

Is there a single cron expression for every 30 seconds?
Cron’s smallest unit is one minute. To run twice a minute, add two entries, one delayed by 30 seconds. For sub-minute schedules, a systemd timer or a long-running worker loop is usually better. The first line runs at :00 and the second at :30 of every minute.
Which time zone does this cron schedule use?
Cron runs in the time zone of the system or service that executes it. Linux servers and cloud schedulers (GitHub Actions, Vercel, AWS EventBridge by default) normally use UTC. Many crontabs accept CRON_TZ=Area/City at the top, and Kubernetes CronJobs have a timeZone field.
How do I stop runs from overlapping?
If a run can take longer than the interval, wrap the command with flock so only one copy runs at a time, for example: * * * * * flock -n /tmp/job.lock /path/to/command. Kubernetes CronJobs use concurrencyPolicy: Forbid for the same effect.
How do I test this schedule before deploying?
Paste the expression into the live checker on this page to see the next 10 run times in UTC and your local time. On Linux, check the system log (grep CRON /var/log/syslog) after the first expected run.