Tutorial

Run a cron job once a week.

The simplest is @weekly, which expands to 0 0 * * 0 — midnight every Sunday. To run on a different day, replace the final 0 with 1 (Mon) through 6 (Sat).

The expression

@weekly /path/to/script.sh
# Equivalent to:
0 0 * * 0 /path/to/script.sh

Common weekly schedules

ExpressionWhen
0 0 * * 0Sunday midnight
0 0 * * 1Monday midnight
0 9 * * 1Monday 9 AM
0 17 * * 5Friday 5 PM
30 23 * * 6Saturday 11:30 PM

Avoiding the Sunday-midnight stampede

Many systems use @weekly for cleanup or maintenance jobs. If you're on a shared server or a cloud provider, midnight Sunday UTC is one of the most contested moments of the week.

Schedule for an off-peak weekday instead:

0 3 * * 2    # Tuesday 3 AM — much less contention

Macros for common weekly times

  • @weekly — Sunday midnight (0 0 * * 0)

That's the only weekly macro. For any other day or time, use the explicit form.

Platform examples

Linux crontab

0 3 * * 1 /usr/local/bin/weekly-cleanup.sh

AWS EventBridge

cron(0 3 ? * MON *)

Kubernetes CronJob

schedule: "0 3 * * 1"

Verifying the schedule

Always paste your expression into the explainer and check the next 5 run times. Weekly jobs are easy to mis-set — if the next run is "in 4 days" when you expected "next Sunday," the expression is wrong.

Related

Continue reading.