Skip to content
Snippets Groups Projects
Commit 5fdaa755 authored by Bob Mottram's avatar Bob Mottram
Browse files

Disk usage

parent e2e27722
No related branches found
No related tags found
No related merge requests found
...@@ -874,6 +874,22 @@ function webadmin_update_system_monitor { ...@@ -874,6 +874,22 @@ function webadmin_update_system_monitor {
disk_use_percent=$(df -h | grep /dev/mmcblk0p1 | awk -F ' ' '{print $5}') disk_use_percent=$(df -h | grep /dev/mmcblk0p1 | awk -F ' ' '{print $5}')
fi fi
backup_disk_use_percent=
if [ -f "$DRIVES_BASELINE_FILE" ]; then
backup_device=$(detect_connected_drives)
if [ "$backup_device" ]; then
backup_mount_drive "$backup_device"
if [ -d "$USB_MOUNT" ]; then
backup_disk_use=$(df -h | grep "$backup_device")
backup_disk_use_percent='0%'
if [[ "$backup_disk_use" == *"$backup_device"* ]]; then
backup_disk_use_percent=$(df -h | grep "$backup_device" | tail -n 1 | awk -F ' ' '{print $5}')
fi
fi
backup_unmount_drive
fi
fi
used_memory=$(free -m | grep "Mem:" | awk -F ' ' '{print $3}') used_memory=$(free -m | grep "Mem:" | awk -F ' ' '{print $3}')
total_memory=$(free -m | grep "Mem:" | awk -F ' ' '{print $2}') total_memory=$(free -m | grep "Mem:" | awk -F ' ' '{print $2}')
used_memory_percent=$((used_memory * 100 / total_memory)) used_memory_percent=$((used_memory * 100 / total_memory))
...@@ -907,6 +923,10 @@ function webadmin_update_system_monitor { ...@@ -907,6 +923,10 @@ function webadmin_update_system_monitor {
sed -i "s|<div name=\"diskspace\" class=\"w3-container.*|<div name=\"diskspace\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:$disk_use_percent\">$disk_use_percent</div>|g" "$webadmin_install_dir/system_monitor.html" sed -i "s|<div name=\"diskspace\" class=\"w3-container.*|<div name=\"diskspace\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:$disk_use_percent\">$disk_use_percent</div>|g" "$webadmin_install_dir/system_monitor.html"
fi fi
if [ "$backup_disk_use_percent" ]; then
sed -i "s|<div name=\"backupspace\" class=\"w3-container.*|<div name=\"backupspace\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:$backup_disk_use_percent\">$backup_disk_use_percent</div>|g" "$webadmin_install_dir/system_monitor.html"
fi
sed -i "s|<div name=\"memory\" class=\"w3-container.*|<div name=\"memory\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:${used_memory_percent}%\">${used_memory_percent}%</div>|g" "$webadmin_install_dir/system_monitor.html" sed -i "s|<div name=\"memory\" class=\"w3-container.*|<div name=\"memory\" class=\"w3-container w3-blue w3-round-xlarge\" style=\"width:${used_memory_percent}%\">${used_memory_percent}%</div>|g" "$webadmin_install_dir/system_monitor.html"
if [ $cpu_temperature -gt 0 ]; then if [ $cpu_temperature -gt 0 ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment