forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
systemd: add weekly and monthly scrub timers
Timers can be enabled as follows: systemctl enable [email protected] --now systemctl enable [email protected] --now Each timer will pull in zfs-scrub@${poolname}.service, which is not schedule-specific. Added PERIODIC SCRUB section to zpool-scrub.8. Reviewed-by: Richard Laager <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Georgy Yakovlev <[email protected]> Closes openzfs#12193
- Loading branch information
Showing
6 changed files
with
64 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*.service | ||
*.target | ||
*.preset | ||
*.timer |
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 |
---|---|---|
|
@@ -12,7 +12,10 @@ systemdunit_DATA = \ | |
zfs-volume-wait.service \ | ||
zfs-import.target \ | ||
zfs-volumes.target \ | ||
zfs.target | ||
zfs.target \ | ||
[email protected] \ | ||
[email protected] \ | ||
[email protected] | ||
|
||
SUBSTFILES += $(systemdpreset_DATA) $(systemdunit_DATA) | ||
|
||
|
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,14 @@ | ||
[Unit] | ||
Description=zpool scrub on %i | ||
Documentation=man:zpool-scrub(8) | ||
Requires=zfs.target | ||
After=zfs.target | ||
ConditionACPower=true | ||
ConditionPathIsDirectory=/sys/module/zfs | ||
|
||
[Service] | ||
ExecStart=/bin/sh -c '\ | ||
if @sbindir@/zpool status %i | grep "scrub in progress"; then\ | ||
exec @sbindir@/zpool wait -t scrub %i;\ | ||
else exec @sbindir@/zpool scrub -w %i; fi' | ||
ExecStop=-/bin/sh -c '@sbindir@/zpool scrub -p %i 2>/dev/null || true' |
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