Here’s a script using Twidge, twitter, mrtg and a little shell scripting to graph workouts.
Twidge, twitter, mrtg and a little shell scripting to graph my workouts
I decided to start working out. Ok, you can get off the floor now. I am working out. I have a really cool, entry level elliptical, the Schwinn 420.
The only problem with the Schwinn 420 is that it’s electronic console does NOT connect to the web. I decided to combat this by tweeting my workouts and having my linux box grab that data and dump it into some mrtg graphs.
First thing I did was setup a new twitter account (@johnsworkout) and follow it with my @beck_on_tech account.
Then I setup twidge, the command line twitter client, on my linux box using my @johnsworkout account.
When I workout I send a message to @johnsworkout with my weight, time on elliptical, distance and calories burned or wtdc as I remember it.
I run a script from cron every 2 hours.
# crontab -l
15 */2 * * * /home/jbeck/scripts/workout-tweet.sh
# vi worktout-tweet.sh
#!/bin/sh
TWEETDATA=`twidge lsrecent -su |grep -i johnsworkout`
if [ “$TWEETDATA” != “” ]; then
echo $TWEETDATA > /tmp/workout.txt
else
exit 1
fi
Then MRTG handles the rest.
Below is the relevant snippets of my workout-mrtg.cfg file:
PageTop[weight]:
YLegend[weight]: Pounds
YLegend[distance]: Miles
YLegend[calories]: Calories
As always, if you’ve got recommendations or a better way, I’m all ears
As an Amazon Associate I earn from qualifying purchases. Read our Privacy Policy for more info.