Backup your Google mail and calendar with Linux

Our lives these days are more digital than ever. Just think about all the stuff you have online. E-mail, photo's, addressbook, calendar and probably a whole lot more. Of course you can trust that your data is safe from harm in "the cloud", it probably is but still a personal backup isn't that bad an idea. Call me paranoid but I like backups, even backups of backups ;).

Anyways, this little blog post will point you towards backing up your Google life (calendar & mail) with the use of a bash shell. It's portable to other *nix based systems including MacOS.......probably :).

Let's start with Google Calendar. You'll need to get your private link to your personal calendar (see the settings of your calendar). Use the link in conjunction with the following bash script (add the private link). It doesn't require any password which is quite nice. You might wanna change the location where the script saves the .ical file

# Wget's main Google calendar private ical file
# Created by: Graham van der Wielen
# Created on: 20100412

### System Setup ###
CP='$(which cp)';
ECHO='$(which echo)';
TOUCH='$(which touch)"
WGET='$(which wget)';
RM='$(which rm)';

### google calendar settings ###
URL='Private Address here';

if [ -f $PIDFILE ]
  echo "Pidfile already exists"
  exit 1



$WGET -c -N --no-check-certificate $URL -o /dev/null


exit 0;

Now it's time for Google mail or Gmail. Backing up your mail is a little more work although shouldn't be a problem. You can choose to backup your mail to one big file of all your mail or put every e-mail. I can't take credit for this part so I'm gonna point you in the right direct. So head over to Matt Cutts blog and read How to back up your Gmail on Linux in four easy steps.

Of course there are more things I'd like to backup. For instance a backup of my OPML file (Google Reade subscription list) would be nice. I'm still working on that but another thing I do backup is Flickr with a very handy python script. I'll post about the Flickr script in my next post.