MT/Livejournal synchronization
16 Apr 2003Jim was asking how I sync’ed my LJ website with this one. (Why did I do this? Well, I only got the LJ account to post comments on friends’ LJ webpages, so I figured I’d just sync the content of my page from here). So, I decided to try to remember, and then post how I did it, just for him! Disclaimer: there are probably more elegant ways to do this than I did.
Basically, I swiped the idea of this guy, which is using a shell script to control blagg and its livejournal-syncing plugin in syncing my movable type website and my livejournal site. I then have this script running in a cronjob every 5 minutes. I tried to make this a CGI script that MT pings when I post, like he did, but failed, and decided not to vest any further effort into something I didn’t really care about, and just dumped it into cron.
The bulk of the script follows:
#!/bin/sh lockfile=/tmp/lj.lck blagg=/home/cwage/bin/blagg plugin=-plugin=livejournal mode=-mode=automatic login=-login=chrismwage password=-passwd=[your password here] REQUEST_METHOD= i=1 while [ $i -lt 5 ]; do if [ ! -e $lockfile ]; then touch $lockfile cd /home/cwage/bin $blagg $plugin $mode $login $password rm $lockfile i=5 else sleep 60 i=$(( $i + 1 )) fi done