Giter Club home page Giter Club logo

tempchart's Introduction

tempchart

Temperature Chart for Raspberry Pi 3

-rpi 3
-highchart
-php+mysql
-bash script with cronjob(to get the temperature and store it into mysql every 1 hour)

#bash script #!/bin/bash
cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp) cpuTemp1=$(($cpuTemp0/1000)) cpuTemp2=$(($cpuTemp0/100)) cpuTempM=$(($cpuTemp2 % $cpuTemp1))

gpuTemp0=$(/opt/vc/bin/vcgencmd measure_temp)

echo CPU Temp: $cpuTemp1"."$cpuTempM"ÂēC"

##ref : http://stackoverflow.com/questions/17997558/bash-script-to-insert-values-in-mysql
echo "INSERT INTO temp_log (cpu) VALUES ($cpuTemp1.$cpuTempM);" | mysql -u[login] -p[password] [databasename];

i'm using nano editor, My command is
sudo nano tempsql.sh
-paste the script-
ctrl+o to save the script
ctrl+x to exit the editor
make the script executeable
chmod +x tempsql.sh
test your script
sudo ./tempsql.sh
check the data on your mysql.

set the cronjob
sudo crontab -e
this will make the script run every 1 hour
0 */1 * * * /home/pms/script/tempsql.sh >> /home/pms/script/log/templog.log &

tempchart's People

Contributors

ayie84 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.