Skip to content

Instantly share code, notes, and snippets.

@dlion
Created December 4, 2012 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlion/4204883 to your computer and use it in GitHub Desktop.
Save dlion/4204883 to your computer and use it in GitHub Desktop.
Script per il controllo della carica e della temperatura della mia slackware
#!/bin/bash
#Script per il controllo della batteria e della temperatura
while :
do
BATT=$(acpitool -b | grep -Po ", (.*)\." | sed -e s/,\ //g | sed -e s/\\.//g)
TEMP=$(cat /sys/class/hwmon/hwmon0/temp1_input)
if [ $BATT -lt 5 ]; then
xmessage "La batteria e' sotto il 5% il pc verra' spento in 8 secondi" -center -timeout 8
halt
fi
if [ $BATT -lt 15 ]; then
xmessage "Guarda che hai solo il 15% di batteria, fallo ricaricare oppure comincia a salvare tutto." -center -timeout 10
fi
if [ $TEMP -gt 89000 ]; then
xmessage "La temperatura e' al limite, il pc verra' spento, raffreddalo!" -center -timeout 5
halt
fi
if [ $TEMP -gt 80000 ]; then
xmessage "La temperatura e' molto alta, stai attento a non sforzarlo troppo che si scassa tutto." -center -timeout 10
fi
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment