rewritten disk checks btrfs because of raid1 or single disk discrepances
This commit is contained in:
parent
850d16c160
commit
3c397c6f1d
|
@ -66,12 +66,10 @@ mounted_btrfs_partitions="$(mount | grep btrfs | awk '{print $3}' | tr '\n' ','
|
||||||
|
|
||||||
for i in ${mounted_btrfs_partitions//,/ }
|
for i in ${mounted_btrfs_partitions//,/ }
|
||||||
do
|
do
|
||||||
# check btrfs errors on mounted device, if all output is 0 then return a single "1"
|
# check btrfs errors on mounted device, if all output is 0 then return a single "1" if 2 disks raid 1, or a 0 if single disk
|
||||||
check_disk_errors=$(btrfs device stats $i | awk '{print $2}' | grep -c 0 -v)
|
check_disk_errors=$(btrfs device stats $i | awk '{print $2}' | grep -c 0 -v)
|
||||||
|
|
||||||
if [ ${check_disk_errors} -eq 1 ] ; then
|
if [ ${check_disk_errors} -gt 1 ] ; then
|
||||||
: # do nothing if output is a single "1"
|
|
||||||
else
|
|
||||||
echo Bad: - Btrfs is detecting errors on partition $i, some disk is about to be broken
|
echo Bad: - Btrfs is detecting errors on partition $i, some disk is about to be broken
|
||||||
echo Sending alert...
|
echo Sending alert...
|
||||||
curl -k --retry 3 \
|
curl -k --retry 3 \
|
||||||
|
|
Loading…
Reference in New Issue