Skip to content

Instantly share code, notes, and snippets.

@cebe
Created February 8, 2014 14:08
Show Gist options
  • Save cebe/8884289 to your computer and use it in GitHub Desktop.
Save cebe/8884289 to your computer and use it in GitHub Desktop.
Script that checks temperature using lm-sensors and reports high temp via beep.
<?php
$templine = `sensors | grep "temp1"`;
//echo $templine . "\n";
if (preg_match('/\+(\d+\.\d+)/', $templine, $matches)) {
$temp = (float) $matches[1];
//echo $temp;
if ($temp > 85) {
`beep -f 2400 -r 3`;
}
} else {
`beep`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment