Skip to content

Commit

Permalink
Update watch_lvm.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Kjeld Schouten <[email protected]>
  • Loading branch information
PrivatePuffin authored Oct 8, 2024
1 parent 6979063 commit 947182b
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions containers/apps/lvm-disk-watcher/includes/watch_lvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,25 @@ while true; do
echo "Disk $disk has partitions. Skipping."
fi
done
# Check if the VG is already active
vg_active=$(vgdisplay "$VG_NAME" | grep "VG Status" | awk '{print $3}')

if [ "$vg_active" == "available" ]; then
echo "Volume group $VG_NAME is already active."
else
echo "Activating volume group $VG_NAME..."
vgchange -ay "$VG_NAME"
if [ $? -eq 0 ]; then
echo "Volume group $VG_NAME has been activated."

# Check if the VG is already active
vg_active=$(vgdisplay "$VG_NAME" | grep "VG Status" | awk '{print $3}')

if [ "$vg_active" == "available" ]; then
echo "Volume group $VG_NAME is already active."
else
echo "Failed to activate volume group $VG_NAME."
echo "Activating volume group $VG_NAME..."
vgchange -ay "$VG_NAME" || echo "Failed to activate volume group $VG_NAME."
if [ $? -eq 0 ]; then
echo "Volume group $VG_NAME has been activated."
fi
fi
fi
else
echo "Configuration file not found. Exiting."
exit 1
fi



echo "sleeping 60 seconds"
sleep 60 # Sleep for 1 minute before checking again
done

0 comments on commit 947182b

Please sign in to comment.