Skip to content

Instantly share code, notes, and snippets.

@Phill93
Last active October 28, 2019 19:15
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 Phill93/ce35f9671d9608d38a28c06b3974b9e1 to your computer and use it in GitHub Desktop.
Save Phill93/ce35f9671d9608d38a28c06b3974b9e1 to your computer and use it in GitHub Desktop.
Script to test the battery runtime
#!/bin/bash
BROKER="test.mosquitto.org"
TOPIC="Phill93/uptime"
sudo apt-get update
sudo apt-get install -y mosquitto-clients
while true; do
mosquitto_pub -r -h $BROKER -t $TOPIC -m "$(awk '{print int($1/3600)":"int(($1%3600)/60)":"int($1%60)}' /proc/uptime)"
ping -c 3 google.com
sleep 10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment