Initial commit
This commit is contained in:
34
customcd/files/root/rescuebru/updatecapacity.sh
Normal file
34
customcd/files/root/rescuebru/updatecapacity.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# updatecapacity.sh
|
||||
# Rescue CD Backup & Restore Utility media capacity update script
|
||||
# version 7.2.5
|
||||
# Rod Wright 1/19/2024
|
||||
# Refer to CHANGELOG file for details.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
RAID_MNT_PT="/mnt/rescuebru"
|
||||
CAPACITY_FILE="/root/capacity.txt"
|
||||
UPDATE_INTERVAL=10
|
||||
|
||||
while true; do
|
||||
if ! mount|grep -q /mnt/rescuebru ; then
|
||||
if ps ax|grep rbruserver|grep -vq grep; then
|
||||
echo "Awaiting RAID mount...">$CAPACITY_FILE
|
||||
else
|
||||
echo "Awaiting backup media...">$CAPACITY_FILE
|
||||
fi
|
||||
else
|
||||
dfout=`df -h $RAID_MNT_PT|grep $RAID_MNT_PT`
|
||||
total=`echo $dfout|awk '{print $2}'`
|
||||
used=`echo $dfout|awk '{print $3}'`
|
||||
available=`echo $dfout|awk '{print $4}'`
|
||||
percentage=`echo $dfout|awk '{print $5}'`
|
||||
|
||||
echo "Total Capacity: $total">$CAPACITY_FILE
|
||||
echo "Used: $used">>$CAPACITY_FILE
|
||||
echo "Available: $available">>$CAPACITY_FILE
|
||||
echo "Percent Usage: $percentage">>$CAPACITY_FILE
|
||||
fi
|
||||
|
||||
sleep $UPDATE_INTERVAL
|
||||
done
|
||||
Reference in New Issue
Block a user