Raspberry Pi script to get cpu/memory/uptime/memory

From a few goole sources I put this script together to grab the cpu temperature, utilization, free memory and uptime from my raspberry pi weather station and write the results to my MySQL database.

I will use this data at some stage in my Weather Station project.

# Script to get Raspberry Pi temperate, cpu, memory, uptime and save data
# to mysql on suse.home. This will be used my the weather station web site system infomation

# Get temperature
temp=`/opt/vc/bin/vcgencmd measure_temp | cut -c 6-9`

# Get Uptime and convert to day h m s

To use the mysql client on the Pi you will need to first install it with:
sudo apt-get install mysql-client

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.