Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Set the path to your webroot here
- WEBROOT='/usr/share/dump1090-fa/html'
- # Get current CPU frequency
- STAT1=$(sudo cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)
- # vcgencmd commands
- # Return current cpu temperature
- STAT2=$(sudo vcgencmd measure_temp)
- STAT2=${STAT2:5:-2}
- # Return current voltage
- STAT3=$(sudo vcgencmd measure_volts)
- STAT3=${STAT3:5:-1}
- # Return throttle state
- STAT4=$(sudo vcgencmd get_throttled)
- STAT4=${STAT4:10}
- # Which Pi model do we have?
- STAT5=$(sudo cat /sys/firmware/devicetree/base/model | tr '\0' '\n')
- JSON_STRING=$( sudo jq -n \
- --arg fr "$STAT1" \
- --arg te "$STAT2" \
- --arg vo "$STAT3" \
- --arg th "$STAT4" \
- --arg mo "$STAT5" \
- '{freq: $fr, temp: $te, volt: $vo, throttle: $th, model: $mo}')
- echo $JSON_STRING > pistats.json
- sudo mv pistats.json $WEBROOT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement