sleepto is a simple alternative to task schedulers like Cron.
It only handles the timing and doesn't run a daemon like other schedulers do. Instead we encourage you to use your systems default init system (for example Systemd) to control your jobs. This allows you to:
Thanks to runwhen for inspiration.
Usage: sleepto [flags...] [command...] Sleep until next time the specified conditions match. Conditions are specified with flags. All flags are optional and can be used in any combination. The condition flags take one or more value each. Values are separated by comma. Note that conditions match not the current, but the next possible match. When the current date is March 2017 and you run 'sleepto -month 3' the execution time is March 1, 2018. A command can be specified optionally. All arguments following the command are passed to it. When the process receives a SIGALRM signal it finishes immediately. Examples: # Next 10th of month at 3pm sleepto -day 10 -hour 15 /bin/send-report # Next occurence of one quarter of hour sleepto -minute 0,15,30,45 say "Hello human" # Next day at 1am sleepto -hour 1 && ~/dbbackup.sh Flags: -day value 1 to 31 -hour value 0 to 23 -minute value 0 to 59 -month value 1 to 12 -second value 0 to 59 -silent Suppress all output -version Print binary version -weekday value mo,tu,we,th,fr,sa,su -year value list of years For more visit: https://qvl.io/sleepto
go get qvl.io/sleepto
brew install qvl/tap/sleepto
sleepto can be used in different scenarios but the most common one is probably to combine it with an init system.
Systemd already runs on most Linux systems.
It even has its own timer implementation which can be the right solution for many use cases.
However, if you don't want to depend on the specific features of one init system or you like to reuse the same logic in other scenarios
sleepto can be the the right tool for that.
See ghbackup for an example on how to use
sleepto in a service.
sudo journalctl -u servicename
sudo systemctl kill -s ALRM servicename
Make sure to use
gofmt and create a Pull Request.
Push a new Git tag and GoReleaser will automatically create a release.