Add zfs-scrub
This commit is contained in:
parent
579d4b6a47
commit
015a8fa5d4
5 changed files with 89 additions and 1 deletions
18
templates/zfs-scrub.sh.j2
Normal file
18
templates/zfs-scrub.sh.j2
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
# https://serverfault.com/questions/538978/how-to-run-a-command-once-a-zfs-scrub-completes
|
||||
set -euo pipefail
|
||||
|
||||
curl -m 10 --retry 5 {{ host.data.zfs_healthchecks }}/start
|
||||
zpool scrub local
|
||||
# wait until scrub is finished
|
||||
while zpool status local | grep -q 'scan: *scrub in progress'; do
|
||||
zpool status local
|
||||
sleep 600
|
||||
done
|
||||
|
||||
zpool status local
|
||||
|
||||
# Get stdout from journalctl
|
||||
LOG=$(journalctl -o cat -r -u zfs-scrub.service -n 100)
|
||||
curl -fsS -m 10 --retry 5 --data-raw "$LOG" {{ host.data.zfs_healthchecks }}
|
||||
exit 0
|
Reference in a new issue