* run at 10 pm on weekdays:
cron: `0 22 * * 1-5`
snooze: `-w1-5 -H22`
-* run 23 minutes after midn, 2am, 4am ..., everyday:
- cron: 23 0-23/2 * * *
+* run 23 minutes after midnight, 2am, 4am ..., everyday:
+ cron: `23 0-23/2 * * *`
snooze: `-H/2 -M23`
* run every second week:
snooze: `-W/2`
* `-R`: add between 0 and RANDDELAY seconds to the scheduled time.
* `-s`: commands are executed even if they are SLACK (default: 60) seconds late.
+The durations RANDDELAY and SLACK and TIMEWAIT are parsed as seconds,
+unless a postfix of `m` for minutes, `h` for hours, or `d` for days is used.
+
The remaining arguments are patterns for the time fields:
* `-d`: day of month
When `-T` is *not* passed, snooze will start finding the first matching time
starting from the mtime of TIMEFILE, and taking SLACK into account.
-(E.g. `-H0 -s$((24*60*60)) -t timefile` will start an instant
+(E.g. `-H0 -s 1d -t timefile` will start an instant
execution when timefile has not been touched today, whereas without `-t`
this would always wait until next midnight.)
If TIMEFILE does not exist, it will be assumed outdated enough to
ensure earliest execution.
-snooze does not update the timefiles, you need to do that!
+snooze does not update the timefiles, your job needs to do that!
Only mtime is looked at, so touch(1) is good.
## Exact behavior
Run a job daily, never twice a day:
- exec snooze -H0 -S $((24*60*60)) -t timefile \
+ exec snooze -H0 -s 1d -t timefile \
sh -c 'run-parts /etc/cron.daily; touch timefile'
Use snooze inline, run a mirror script every hour at 30 minutes past,
but ensure there are at least 20 minutes in between.
set -e
- snooze -H'*' -M30 -t timefile -T $((20*60))
- touch timefile # remove this if instantly retrying on failure is ok
+ snooze -H'*' -M30 -t timefile -T 20m
+ touch timefile # remove this if instantly retrying on failure were ok
mirrorallthethings
touch timefile
set -e
snooze ...
- actualjob >output 2>&1 ||
+ actualjob >output 2>&1 ||
mail -s "$(hostname): snooze job failed with status $?" root <output
## Installation