mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
systemd: add weekly and monthly scrub timers
Timers can be enabled as follows: systemctl enable zfs-scrub-weekly@rpool.timer --now systemctl enable zfs-scrub-monthly@datapool.timer --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 <rlaager@wiktel.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> Closes #12193
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
*.service
|
||||
*.target
|
||||
*.preset
|
||||
*.timer
|
||||
|
||||
@@ -12,7 +12,10 @@ systemdunit_DATA = \
|
||||
zfs-volume-wait.service \
|
||||
zfs-import.target \
|
||||
zfs-volumes.target \
|
||||
zfs.target
|
||||
zfs.target \
|
||||
zfs-scrub-monthly@.timer \
|
||||
zfs-scrub-weekly@.timer \
|
||||
zfs-scrub@.service
|
||||
|
||||
SUBSTFILES += $(systemdpreset_DATA) $(systemdunit_DATA)
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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'
|
||||
Reference in New Issue
Block a user