-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add zfs-scrub systemd units (#146)
Co-authored-by: Benjamin Sherman <[email protected]>
- Loading branch information
Showing
4 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=Monthly zpool scrub timer for %i | ||
Documentation=man:zpool-scrub(8) | ||
|
||
[Timer] | ||
OnCalendar=monthly | ||
Persistent=true | ||
RandomizedDelaySec=1h | ||
Unit=zfs-scrub@%i.service | ||
|
||
[Install] | ||
WantedBy=timers.target |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=Weekly zpool scrub timer for %i | ||
Documentation=man:zpool-scrub(8) | ||
|
||
[Timer] | ||
OnCalendar=weekly | ||
Persistent=true | ||
RandomizedDelaySec=1h | ||
Unit=zfs-scrub@%i.service | ||
|
||
[Install] | ||
WantedBy=timers.target |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[Unit] | ||
Description=zpool scrub on %i | ||
Documentation=man:zpool-scrub(8) | ||
Requires=zfs.target | ||
After=zfs.target | ||
ConditionACPower=true | ||
ConditionPathIsDirectory=/sys/module/zfs | ||
|
||
[Service] | ||
EnvironmentFile=-@initconfdir@/zfs | ||
ExecStart=/bin/sh -c '\ | ||
if /usr/sbin/zpool status %i | grep -q "scrub in progress"; then\ | ||
exec /usr/sbin/zpool wait -t scrub %i;\ | ||
else exec /usr/sbin/zpool scrub -w %i; fi' | ||
ExecStop=-/bin/sh -c '/usr/sbin/zpool scrub -p %i 2>/dev/null || true' |