How to back-up Zotero

This is a quick blog to show you how I am backing up my Zotero (Ubuntu and Firefox)

This is a script that I whipped up for myself, this runs every month using a cron job. It basically stops Firefox if it is running (freeing up the Zotero sqlite file) compresses the entire Zotero dorectory and then emails that to you.

#!/bin/bash
zotero_directory="/CHANGE/ME
tar_name="/CHANGE/ME/zotero.tar.bz2"
email="CHANGE@ME.COM"
regex=.*[Ff]irefox.*
echo "Checking Firefox processes"
echo "ps ax | grep -e $regex"
echo "Killing Firefox processes"
killall -r $regex
if [ $? == 1 ]
then
        echo "Firefox was not in use anyway"
else
        echo "Firefox process killed"
fi
echo "Compressing Zotero Directory $zotero_directory to Tar File $tar_name"
if [ -f $tar_name ]
then
        echo "Tar file already exists, script must not have completed last time, removing tar file now"
        rm -rf $tar_name
fi
echo "Creating new tar file"
tar -cjvf $tar_name $zotero_directory
echo "Sending Tar File $tar_name to $email"
mutt -s "cairss zotero backup" -a $tar_name $email
sleep 10
rm -rf $tar_name

Advertisements

One thought on “How to back-up Zotero

  1. nice. I wonder though, if it’s really worth it any more to come up with specific systems of backup for Zotero. I just use backintime (or any other rsync app) to very regularly back up my entire home director, hidden files included – considering how cheap flash memory has become there is really no excuse not to.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s