Skip to content

Instantly share code, notes, and snippets.

@benoitjpnet
Created April 16, 2013 09:37
Show Gist options
  • Save benoitjpnet/5394672 to your computer and use it in GitHub Desktop.
Save benoitjpnet/5394672 to your computer and use it in GitHub Desktop.
Check temperature of CPU and send mail if critical threshold is reached.
#!/bin/sh
[email protected]
subject="Warning: Temperature critical"
critical=50
temperature=$(sensors -u coretemp-isa-0000 | grep temp2_input | grep -Eo "[0-9.]{2,}")
calc=$(echo "$temperature >= $critical" | bc)
if (( $calc )); then
echo -e "Attention, la température du processeur de la machine samba a dépassé le seuil\nde $critical °C ! Elle est actuellement de $temperature °C.\n\nVérifiez la climatisation de la salle serveur." | mail -s "$subject" "$mailto"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment