X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=README.md;h=d5e86d1ad6961052e25ad77647eef559252db9a0;hb=9034895827a878c756c58da7136251e3a8668c94;hp=5831e81f4a6e569cc4951f589b7b84453faca3b6;hpb=a4aabb05a1673be34780f340428d6b11405cce08;p=user%2Fhenk%2Fcode%2Fsnooze.git diff --git a/README.md b/README.md index 5831e81..d5e86d1 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,8 @@ Over uschedule: * 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` @@ -61,6 +61,9 @@ Over uschedule: * `-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 @@ -99,14 +102,14 @@ of TIMEFILE plus TIMEWAIT seconds. 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 @@ -136,15 +139,15 @@ Run a job like cron, every day at 7am and 7pm: 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 @@ -152,7 +155,7 @@ Use snooze inline, cron-style mail: set -e snooze ... - actualjob >output 2>&1 || + actualjob >output 2>&1 || mail -s "$(hostname): snooze job failed with status $?" root