2024-03-15 18:18:13 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
REPORT_EMAIL=email@thomasave.be
|
|
|
|
|
2024-04-29 10:52:06 +02:00
|
|
|
ZPOOL_STATUS=$(zpool status -x)
|
|
|
|
if [ "$ZPOOL_STATUS" = "all pools are healthy" ] || [ "$ZPOOL_STATUS" = "no pools available" ]
|
2024-03-15 18:18:13 +01:00
|
|
|
then
|
2024-04-29 10:52:06 +02:00
|
|
|
printf 0 > /var/db/zpool.status
|
2024-03-15 18:18:13 +01:00
|
|
|
else
|
2024-04-29 10:52:06 +02:00
|
|
|
if [ "$(cat /var/db/zpool.status)" -eq 0 ]
|
2024-03-15 18:18:13 +01:00
|
|
|
then
|
|
|
|
zpool status | mail -s "ZPOOL NOT HEALTHY" $REPORT_EMAIL
|
2024-04-29 10:52:06 +02:00
|
|
|
printf 1 > /var/db/zpool.status
|
2024-03-15 18:18:13 +01:00
|
|
|
fi
|
|
|
|
fi
|