Traditionally, a dedicated daemon is used to run commands at a specified time or interval. This daemon is called cron. The POSIX standard defines the minimum configuration format. There are many implementations of cron, like vixie-cron, cronie dcron, and fcron. Since all of them are fairly portable, the source directories are part of goetia-base.
The design of any cron has a couple of downsides:
This design originates from before supervision suites. Using supervision suites, a much more simple and elegant design is possible: snooze.
Snooze is a very simple program: flags passed to it tell snooze for how long or until when it has to block (wait). The arguments passed after those flags are the command line to run once the time has come. For example:
snooze -H 12 echo "Hello!"
runs echo "Hello!"
the next time it is 12:00, noon.
After that, it exits.
All possible combinations of arguments to
get more specific timings are documented on the
snooze repository
and man snooze.
This can be elegantly combined with supervision:
A longrun service is created,
containging the above example as the run
script.
At 12:00, it will run,
exit 0 and be automatically restarted by
s6-supervise
to wait until the next noon.
This way, each job that has to be run at a specific time is nicely confined and can be run as a different user. Additionally, each user having a user supervision tree can have their own timed jobs, without any complex permission handling.