Skip to content
Permalink
Browse files

Add error handling to thermal sensor check

  • Loading branch information...
NEMS Linux
NEMS Linux committed Apr 7, 2019
1 parent 97223a6 commit 460f75a626e74f6f0aa012e7e6ca42e8e74c58a1
Showing with 12 additions and 1 deletion.
  1. +5 −0 fixes.sh
  2. +6 −1 info2.sh
  3. +1 −0 upgrade.sh
@@ -407,6 +407,11 @@ if (( $(awk 'BEGIN {print ("'$ver'" >= "'1.5'")}') )); then
/root/nems/nems-admin/build/999-cleanup
fi

# Patch check_rpi_temperature to include error handling for when the thermal sensor doesn't exist (ie., VM)
if ! grep -q "PATCH-000006" /var/log/nems/patches.log; then
cp -f /root/nems/nems-migrator/data/1.5/nagios/plugins/check_rpi_temperature /usr/lib/nagios/plugins/
echo "PATCH-000006" >> /var/log/nems/patches.log
fi


fi
@@ -16,7 +16,12 @@ if (isset($argv[2]) && strlen($argv[2]) > 0) {
switch($argv[1]) {
case 1: // temperature
$temp = (floatval(file_get_contents('/sys/class/thermal/thermal_zone0/temp')));
if (!file_exists('/sys/class/thermal/thermal_zone0/temp')) {
echo 0;
break;
}
$temp = file_get_contents('/sys/class/thermal/thermal_zone0/temp');
$temp = (floatval($temp));
if ($temp > 1000) $temp = ($temp/1000); // this board logs microunits
if ($temp > 0) {
echo trim($temp) . PHP_EOL;
@@ -324,6 +324,7 @@ vm.swappiness = 10
echo ""
fi


# Run the selected patches
if [[ $PATCH000001 =~ ^([yY][eE][sS]|[yY])$ ]]; then
/root/nems/nems-admin/nems-upgrade/patches/000001 && upgraded=1

0 comments on commit 460f75a

Please sign in to comment.
You can’t perform that action at this time.