HistoBot

Tony's Wiki | bash

I wrote a bot that posts historical facts daily to my friendica profile, plus, xposts to my other blogs, and the friendica History group.

#!/bin/bash
 
# post history to @history group on friendica
 
filedate=$(date +%m%d%y%H%M%S)
# use bsd calendar, pipe to file, add taggs
calendar -A 0 > ~/$filedate
echo "#history @history" >> ~/$filedate
echo "http://tonyb.us/today" >> ~/$filedate
sed 's/\&/and/g' ~/$filedate > ~/histob0t
ud=$(cat ~/histob0t)
 
title="Today in History"
# send update with curl
curl --ssl -u tony:******** -d \ 
"status=$ud&title=$title&ljpost_enable=1&posterous_enable=1&tumblr_enable=1&dwpost_enable=1&ijpost_enable=1&statusnet_enable=1&source=myHistobot" \ 
https://free-haven.org/api/statuses/update.xml
#cleanup
rm ~/$filedate
rm ~/histob0t
# b'bye
exit

I have cron fire it off every morning with

  05 2 * * * /usr/local/bin/histobot  

And that's that.

tonybaldwin 2012.05.07.12.50

~~DISQUS~~