Last active
May 16, 2018 18:39
-
-
Save etskinner/a6d109838f3674360b5c73e6bbd9ca3b to your computer and use it in GitHub Desktop.
rsnapshot systemd timers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# systemd list-timers | |
---------------------- | |
NEXT LEFT LAST PASSED UNIT ACTIVATES | |
Sat 2016-05-14 21:00:00 EDT 2min 56s ago Sat 2016-05-14 21:00:00 EDT 2min 56s ago rsnapshot-hourly.timer [email protected] | |
Sat 2016-05-14 23:50:00 EDT 2h 47min left Fri 2016-05-13 23:50:00 EDT 21h ago rsnapshot-daily.timer [email protected] | |
... | |
Sun 2016-05-15 23:40:00 EDT 1 day 2h left n/a n/a rsnapshot-weekly.timer [email protected] | |
Sun 2016-06-05 23:30:00 EDT 3 weeks 1 days left n/a n/a rsnapshot-monthly.timer [email protected] | |
[email protected] | |
------------------ | |
[Unit] | |
Description=rsnapshot (%I) backup | |
[Service] | |
Type=oneshot | |
Nice=19 | |
IOSchedulingClass=3 | |
ExecStart=/usr/bin/rsnapshot %I | |
rsnapshot-hourly.timer | |
---------------------- | |
[Unit] | |
Description=rsnapshot hourly backup | |
[Timer] | |
OnCalendar=hourly | |
Persistent=true | |
[email protected] | |
[Install] | |
WantedBy=timers.target | |
rsnapshot-daily.timer | |
--------------------- | |
[Unit] | |
Description=rsnapshot daily backup | |
[Timer] | |
OnCalendar=23:50 | |
Persistent=true | |
[email protected] | |
[Install] | |
WantedBy=timers.target | |
rsnapshot-weekly.timer | |
---------------------- | |
[Unit] | |
Description=rsnapshot weekly backup | |
[Timer] | |
OnCalendar=Sun, 23:40 | |
Persistent=true | |
[email protected] | |
[Install] | |
WantedBy=timers.target | |
rsnapshot-monthly.timer | |
----------------------- | |
[Unit] | |
Description=rsnapshot monthly backup | |
[Timer] | |
OnCalendar=Sun *-*-1,2,3,4,5,6,7 23:30 | |
Persistent=true | |
[email protected] | |
[Install] | |
WantedBy=timers.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For anyone who comes across this as I did, I wanted to note something helpful for those duplicating your example.
Firstly, ranges were added at some point the last couple of years for date strings. So the monthly OnCalendar string can be reduced to the following:
Sun *-*-1..7 23:30
.Personally, I fought with the OnCalendar spec to make things behave exactly as I wanted. There is a tool to ease testing of OnCalendar strings,
systemd-analyze
. For example, in testing a quarterly timer I can run the following: