mirror of
https://github.com/ShaYmez/ezservermonitor-web.git
synced 2025-08-10 01:02:26 -04:00
checks if the file exists before trying the command for the cpu temperature
This commit is contained in:
parent
3b04b43e17
commit
fffe83f2c7
@ -64,7 +64,7 @@ if ($frequency == 'N.A')
|
|||||||
// CPU Temp
|
// CPU Temp
|
||||||
if ($Config->get('cpu:enable_temperature'))
|
if ($Config->get('cpu:enable_temperature'))
|
||||||
{
|
{
|
||||||
if (exec('/usr/bin/sensors | grep -E "^(CPU Temp|Core 0)" | cut -d \'+\' -f2 | cut -d \'.\' -f1', $t))
|
if (file_exists('/usr/bin/sensors') && exec('/usr/bin/sensors | grep -E "^(CPU Temp|Core 0)" | cut -d \'+\' -f2 | cut -d \'.\' -f1', $t))
|
||||||
{
|
{
|
||||||
if (isset($t[0]))
|
if (isset($t[0]))
|
||||||
$temp = $t[0].' °C';
|
$temp = $t[0].' °C';
|
||||||
@ -88,4 +88,4 @@ $datas = array(
|
|||||||
'temp' => $temp,
|
'temp' => $temp,
|
||||||
);
|
);
|
||||||
|
|
||||||
echo json_encode($datas);
|
echo json_encode($datas);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user