Script to back up entries

Created a script to back up my journal (current month) onto my shell account, in case Live Journal should tank at some future point. In its default state it downloads the current month, and is suitable for running every night. If you uncomment the foreach loops it will back up those months you plug in.

The strategy is to back up the current month every night right before midnight. The risk here is that if I backdate some entries to before the current month, they wouldn’t be backed up, and I would need to run those months again manually. Hmm.

#!/bin/csh

set user="YOURNAME"
set dir="/home/YOURNAME/livejournal"
set year=`date +%Y`
set month=`date +%m`
set options="-q"

##foreach year ( 2002 )
##foreach month ( 01 02 )

set file="$dir/$user-$year-$month.xml"

set url="http://www.livejournal.com/export_do.bml?&user=gconnor&password=YOURPASS&year=${year}&month=
${month}&format=xml&field_itemid=1&field_eventtime=1&field_logtime=1&field_subject=1&field_event=1&f
ield_security=1&field_allowmask=1"

wget $options --output-document=$file "$url"

##end
##end

0 thoughts on “Script to back up entries

Leave a Reply