Update watch_lvm.sh

Signed-off-by: Kjeld Schouten <info@kjeldschouten.nl>
This commit is contained in:
Kjeld Schouten
2024-10-08 13:34:08 +02:00
committed by GitHub
parent 6979063a8c
commit 947182bc45
@@ -86,6 +86,7 @@ while true; do
echo "Disk $disk has partitions. Skipping." echo "Disk $disk has partitions. Skipping."
fi fi
done done
# Check if the VG is already active # Check if the VG is already active
vg_active=$(vgdisplay "$VG_NAME" | grep "VG Status" | awk '{print $3}') vg_active=$(vgdisplay "$VG_NAME" | grep "VG Status" | awk '{print $3}')
@@ -93,11 +94,9 @@ if [ "$vg_active" == "available" ]; then
echo "Volume group $VG_NAME is already active." echo "Volume group $VG_NAME is already active."
else else
echo "Activating volume group $VG_NAME..." echo "Activating volume group $VG_NAME..."
vgchange -ay "$VG_NAME" vgchange -ay "$VG_NAME" || echo "Failed to activate volume group $VG_NAME."
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Volume group $VG_NAME has been activated." echo "Volume group $VG_NAME has been activated."
else
echo "Failed to activate volume group $VG_NAME."
fi fi
fi fi
else else
@@ -106,6 +105,6 @@ fi
fi fi
echo "sleeping 60 seconds"
sleep 60 # Sleep for 1 minute before checking again sleep 60 # Sleep for 1 minute before checking again
done done