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

Check that temperature value is returned

parent cf21ec99
No related branches found
No related tags found
No related merge requests found
......@@ -1400,8 +1400,11 @@ function update_system_monitor {
total_memory=$(free -m | grep "Mem:" | awk -F ' ' '{print $2}')
used_memory_percent=$((used_memory * 100 / total_memory))
cpu_temperature=0
cpu_temp=$(cat /sys/class/thermal/thermal_zone*/temp | head -n 1)
cpu_temperature=$((cpu_temp / 1000))
if [ "$cpu_temp" ]; then
cpu_temperature=$((cpu_temp / 1000))
fi
local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local
webadmin_install_dir="/var/www/${local_hostname}/htdocs/admin"
......
......@@ -705,8 +705,11 @@ function webadmin_update_system_monitor {
total_memory=$(free -m | grep "Mem:" | awk -F ' ' '{print $2}')
used_memory_percent=$((used_memory * 100 / total_memory))
cpu_temperature=0
cpu_temp=$(cat /sys/class/thermal/thermal_zone*/temp | head -n 1)
cpu_temperature=$((cpu_temp / 1000))
if [ "$cpu_temp" ]; then
cpu_temperature=$((cpu_temp / 1000))
fi
local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local
webadmin_install_dir="/var/www/${local_hostname}/htdocs/admin"
......
......@@ -5,7 +5,7 @@
$output_filename = "settings.html";
if (isset($_POST['submitsystemmonitor'])) {
$system_monitor_file = fopen(".system_monitor.txt", "w") or die("Unable to create setup file");
$system_monitor_file = fopen(".system_monitor.txt", "w") or die("Unable to create system monitor file");
fwrite($system_monitor_file, " ");
fclose($system_monitor_file);
$output_filename = "system_monitor.html";
......
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