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
TWEETDATA=`twidge lsrecent -su |grep -i johnsworkout`
if [ “$TWEETDATA” != “” ]; then
echo $TWEETDATA > /tmp/workout.txt
Then MRTG handles the rest.
Below is the relevant snippets of my workout-mrtg.cfg file:
As always, if you’ve got recommendations or a better way, I’m all ears