X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=README.md;h=600bd08c16767eba16d7adee291875accfbce44e;hb=f62a5e3b2e05e3aa0c8bb6b0bfec83c760778ef3;hp=99a615ccc7331d2bbb5b13bcccc563afceccaea7;hpb=36a30a70086a83ad3d74b344b51baa57366b034d;p=user%2Fhenk%2Fcode%2Fsnooze.git diff --git a/README.md b/README.md index 99a615c..600bd08 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ ## snooze: run a command at a particular time -`snooze` is a new tool for to wait until a particular time and then -run a command. Together with a service supervision system such as runit, -this can be used to replace cron(8). +`snooze` is a new tool for waiting until a particular time and then +running a command. Together with a service supervision system such as +runit, this can be used to replace cron(8). -`lr` has been tested on Linux 4.2. +`snooze` has been tested on Linux 4.2. It will likely work on other Unix-like systems with C99. ## Benefits @@ -34,6 +34,17 @@ Over uschedule: - due to supervision, no centralized daemon required - filtering by ISO week and day of year +Over systemd timers: +- mnemonic syntax +- less complexity for jobs, no need for a `.timer` file distinct + from the `.service` file, +- can use a file timestamp to ensure minimum waiting time between two + runs, even across reboots +- very robust with respect to external time changes +- randomized delays +- variable slack +- ad-hoc usage possible, just run the program from command line + ## Rosetta stone * run five minutes after midnight, every day: @@ -41,7 +52,7 @@ Over uschedule: snooze: `-M5` * run at 2:15pm on the first of every month: cron: `15 14 1 * *` - snooze: `-d1 -H2 -M15` + snooze: `-d1 -H14 -M15` * run at 10 pm on weekdays: cron: `0 22 * * 1-5` snooze: `-w1-5 -H22` @@ -60,10 +71,11 @@ Over uschedule: * `-n`: dry-run, print the next 5 times the command would run. * `-v`: verbose, print scheduled (and rescheduled) times. * `-t`, `-T`: see below timefiles -* `-R`: add between 0 and RANDDELAY seconds to the scheduled time. +* `-R`: add between 0 and RANDDELAY seconds to the start of the scheduled time. +* `-J`: add between 0 and JITTER seconds to scheduled execution 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, +The durations RANDDELAY and JITTER 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: @@ -127,9 +139,10 @@ Only mtime is looked at, so touch(1) is good. execs the command. You need to ensure (by setting up supervision) snooze runs again after that! * if we woke due to a SIGALRM, the command is executed immediately as well +* if we notice time moved backwards, recompute the time until the event * if the event is in the future, recompute the time it takes, possibly considering shifting of the system time or timezone changes - (possibly only works on glibc) + (timezone reload only tested on glibc) * If no command was given, just return with status 0 * and so on... @@ -160,6 +173,16 @@ Use snooze inline, cron-style mail: actualjob >output 2>&1 || mail -s "$(hostname): snooze job failed with status $?" root -has waived all copyright and related or -neighboring rights to this work. +To the extent possible under law, Leah Neukirchen +has waived all copyright and related or neighboring rights to this work. http://creativecommons.org/publicdomain/zero/1.0/