
I recently noticed that my primary ZFS array was at 78% capacity and ordered some larger disks. After replacing the first for six disks, zpool status reported it would take approximately 20 hours to resilver each of the 6 disks.
I wanted a way to keep an eye on the status, and more importantly, get a notification when each disk was complete so I could start the next one.
Having recently switched to Hyprland with Waybar, I decided to see what was possible for dynamic status and notification upon completion.
After a few minutes of investigation, here is what I came up with.
Using a Waybar Custom Module with a bash script and Pushbullet I was able to get dynamic updates in my status bar and receive a notification on my phone when the process completes.
Waybar config
"custom/resilver": {
"exec": "~/bin/resilver-status",
"format": "{}"
},
Bash Script
#!/usr/bin/env bash
while true; do
ssh nil@pinky "zpool status tank -v | grep 'to go'"
if [ $? -ne 0 ]; then
echo "Resilver completed"
~/bin/pushover "Resilver complete!"
break
fi
sleep 5
done
Pushbullet script
#!/usr/bin/env bash
MESSAGE="$1"
curl -s \
--form-string "token=sdlfkjadslfjaf" \
--form-string "user=krjtgjwrelktjerlkjwrt" \
--form-string "message=$(MESSAGE)" \
https://api.pushover.net/1/messages.json