Skip to content

Commit c99e0d5

Browse files
committed
Replace individually installed systemd units with zfs-auto.target
1 parent 91b91c3 commit c99e0d5

File tree

6 files changed

+11
-13
lines changed

6 files changed

+11
-13
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ install:
1414
install timers/zfs-auto-hourly.timer $(DESTDIR)$(PREFIX)/lib/systemd/system/zfs-auto-hourly.timer
1515
install timers/zfs-auto-weekly.service $(DESTDIR)$(PREFIX)/lib/systemd/system/zfs-auto-weekly.service
1616
install timers/zfs-auto-weekly.timer $(DESTDIR)$(PREFIX)/lib/systemd/system/zfs-auto-weekly.timer
17+
install timers/zfs-auto.target $(DESTDIR)$(PREFIX)/lib/systemd/system/zfs-auto.target

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ You can find some example `.timer` files in the `timers/` directory of this repo
2929
You can enable the timers as follows:
3030
```
3131
sudo systemctl daemon-reload
32-
sudo systemctl start zfs-auto-hourly.timer && sudo systemctl enable zfs-auto-hourly.timer
33-
sudo systemctl start zfs-auto-daily.timer && sudo systemctl enable zfs-auto-daily.timer
34-
sudo systemctl start zfs-auto-weekly.timer && sudo systemctl enable zfs-auto-weekly.timer
32+
sudo systemctl start zfs-auto.target && sudo systemctl enable zfs-auto.target
3533
```
3634

37-
If you wish to edit the timers, you will find them in the `/etc/systemd/system/` directory.
35+
If you wish to edit the timers, you will find them in the `/usr/local/lib/systemd/system/` directory. Save the edited timers to `/etc/systemd/system/` directory.
3836

3937

4038
Managing Which Pools to Snapshot

timers/zfs-auto-daily.timer

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ Description=Daily ZFS snapshots at 1:20AM.
33

44
[Timer]
55
OnCalendar=*-*-* 01:20:00
6-
7-
[Install]
8-
WantedBy=timers.target

timers/zfs-auto-hourly.timer

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ Description=Hourly ZFS snapshots at 0min past the hour.
33

44
[Timer]
55
OnCalendar=*-*-* *:00:00
6-
7-
[Install]
8-
WantedBy=timers.target

timers/zfs-auto-weekly.timer

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ Description=Weekly ZFS snapshots on Mondays at 1:30AM.
33

44
[Timer]
55
OnCalendar=Mon *-*-* 01:30:00
6-
7-
[Install]
8-
WantedBy=timers.target

timers/zfs-auto.target

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Unit]
2+
Description=Automatically create, rotate, and destroy periodic ZFS snapshots.
3+
Requires=zfs-auto-daily.timer
4+
Requires=zfs-auto-hourly.timer
5+
Requires=zfs-auto-weekly.timer
6+
7+
[Install]
8+
WantedBy=timers.target

0 commit comments

Comments
 (0)