Skip to content
Cron Cookbook

Run a job every minute

The cron expression for every minute is * * * * *. A * in all five fields matches every minute of every hour and day, 1,440 runs a day. That is as often as cron goes: it has no seconds field.

crontab syntax · 5 fields
*****

Next 5 runs

Vercel always runs schedules in UTC, and GitHub Actions does unless you set a time zone. Crontab and Kubernetes use the server's time zone.

Field by field

*Minute
Every minute
*Hour
Every hour, 0 to 23
*Day of month
Every day of the month
*Month
Every month
*Day of week
Every day of the week

By platform

Most schedulers take the same five fields. The wrapper, time zone and limits differ.

crontab -e
# m h  dom mon dow   command
* * * * * /usr/local/bin/sync.sh >> /var/log/sync.log 2>&1

Runs in the server's local time zone

Cron starts jobs with a minimal environment: use absolute paths, and send output to a log so failures don't disappear.

Other every-minute schedules

Keep the minute as * and narrow the hour or weekday fields to run every minute only part of the time.

ExpressionRuns
*/1 * * * *Same as * * * * *, written as a step of 1
* 9-17 * * 1-5Every minute from 09:00 through 17:59, Monday through Friday
* 0 * * *Every minute from 00:00 through 00:59, then not until tomorrow
*/2 * * * *Every 2 minutes, 720 runs a day

Run a cron job every 30 seconds

No cron expression runs more often than once a minute, because cron checks its table once a minute. To run a job every 30 seconds, add it twice: one line runs at the start of each minute, the other waits 30 seconds first.

crontab -e
# Every 30 seconds: at :00 and :30 of every minute
* * * * * /usr/local/bin/job.sh
* * * * * sleep 30; /usr/local/bin/job.sh

For every 20 seconds use three lines (no sleep, sleep 20, sleep 40); for every 15 seconds, four. If a run can take longer than the gap, start the command with flock -n /tmp/job.lock so a new run is skipped while the last one is still going.

Schedulers that have a seconds field can do it in one line:

SchedulerEvery 30 seconds
systemd timerOnCalendar=*:*:0/30 with AccuracySec=1s; the default accuracy of one minute would blur the runs together
Quartz*/30 * * * * ?
Spring @Scheduled*/30 * * * * *

Kubernetes CronJobs and AWS EventBridge stop at one minute, and GitHub Actions at five.

Test that cron works with an every-minute job

Because * * * * * fires at the start of every minute, it is the quickest way to check that cron runs jobs at all before you trust it with a real schedule.

Open your crontab with crontab -e, add this line, save, and wait a minute or two. The change applies without restarting cron; the first run comes at the start of the next minute or the one after.

crontab -e
# Temporary: prove that cron runs your jobs, then delete this line
* * * * * date >> /tmp/cron-test.log 2>&1

Then check the file and cron's log:

terminal
tail -f /tmp/cron-test.log                 # a new line each minute
journalctl -u cron --since "5 min ago"     # Debian and Ubuntu: look for CMD lines
journalctl -u crond --since "5 min ago"    # Fedora and RHEL

A new line in the file every minute means cron and your crontab work, so if your real job still fails the cause is the command: its PATH, working directory or permissions. No line and no CMD entry in the log means cron never started it; work through cron job not running and check that the cron service is running.

When you're done, delete the line in crontab -e. Don't use crontab -r: it removes the whole crontab, not one job.

An every-minute job is 1,440 runs a day

Output that cron would mail arrives 1,440 times a day, and a log grows by as many lines. For a job you keep, set MAILTO="" and send output to a file you rotate:
crontab -e
MAILTO=""
* * * * * /usr/local/bin/job.sh >> /var/log/job.log 2>&1