— run a
command at a particular time
waits until a particular time and then runs
a command. Together with a service supervision system such as
, this can be used to
The options are as follows:
- Dry run: print the next 5 times the command would run and
- Verbose: print scheduled (and rescheduled) times.
- See below,
- Wait randomly up to
randdelay seconds later than the
- Commands are executed even if they are
slack (default: 60) seconds late.
The durations randdelay
are parsed as seconds, unless a
postfix of m
for hours, or d
for days is used.
The remaining arguments are patterns for the time fields:
- day of month
- weekday (0-7, sunday is 0 and 7)
- day of year (1..366)
- ISO week of year (1..53)
The following syntax is used for these options:
- exact match: run on the 3rd
- alternation: run on 3rd, 10th, 27th
- range: run on 1st, 2nd, 3rd, 4th, 5th
- star: run every day
- repetition: run on 5th, 10th, 15th, 20th, 25th, 30th
- shifted repetition: run on 7th, 12th, 17th, 22nd, 27th
and combinations of those, e.g. -d 1-10,15/5,28
The defaults are -d* -m* -w* -D* -W* -H0 -M0 -S0
that is, every midnight.
Note that all
patterns need to match (contrary to
where either day of month
day of week matches), so
only runs on Friday the 13th.
signal, the command is immediately
Optionally, you can keep track of runs in time files, using
is passed, execution will not start earlier
than the mtime of timefile
will start finding the first matching time
starting from the mtime of timefile
into account. (E.g.
-H0 -s 1d -t timefile
will start an instant
execution when timefile has not been touched today, whereas without
this would always wait until next midnight.)
does not exist, it will be assumed
outdated enough to ensure earliest execution.
does not update the timefiles, your job
needs to do that! Only mtime is looked at, so
utility exits 0 on success,
and >0 if an error occurs.
is run using exec, so its exit
status gets propagated to the parent.
If no command was given, snooze
just returns with
is in the public domain.
To the extent possible under law, the creator of this work has waived all
copyright and related or neighboring rights to this work.