A quick backup script for you tonight

I just got back from a great day at the Ubuntu Michigan LoCo edition of the Global Jam were we tested Lucid on a ton of different hardware. It was a great time. See the photos.

But, what I want to share with you right now is a quick script I whipped up to backup my Google Calendars nightly. This is one of the steps in my on-going process of making sure all of my personal data is backed up by me on machines I control with an eye to migrating to self (or friend) hosted services. Yes, I want services I use to follow the Franklin Street Statement.

Until the day that all of the services I use follow the Franklin Street Statement recommendations, I will just have to make sure I make personal backups of my information. So tonight, I finally did that for Google Calendars. It was pretty simple, really:

#!/bin/sh
# Backup my Google Calendars

WORK="/home/greg/backup/google/work-`date +%F`.ics"
PERSONAL="/home/greg/backup/google/personal-`date +%F`.ics"
OPENMICHIGAN="/home/greg/backup/google/open_michigan-`date +%F`.ics"
MILOCO="/home/greg/backup/google/miloco-`date +%F`.ics"

wget private_url_for_work_calendar -O $WORK
wget private_url_for_personal -O $PERSONAL
wget private_url_for_otherwork -O $OPENMICHIGAN
wget private_url_for_the_loco -O $MILOCO

# Remove files that are older than 1 week
find /home/greg/backup/google/*.ics -mtime +7 -exec rm -f {} \;

That’s it. Create the filenames for the various calendars I’m backing up, including today’s date. Then wget them. Then, delete any .ics file that is older than a week. Not sure why I need 7 days of backup, but better safe than sorry, I guess.

7 comments.

  1. How/where do I find the ‘private URL’ for my google calendar?

  2. I was just wondering how far you’ve got with using services that adhere to the Franklin Street Statement? It’s something I’ve been interested in working towards too, using services that follow the statement, but have found the alternatives available to existing (mostly Google) services lacking, either in features, or in the necessity to run them on my own server which is both inefficient energy wise, and man power wise.

    I’ve been intrigued by the idea of setting up a small co-op of some form, which, while not perfect in terms of data distribution etc, at least places the responsibility for the data in the hands of a small group of trusted people. This would share out man power, and reduce the resources per user, I guess…

    Anyhow, I was mostly interested in what approach you’ve been taken to these issues, beyond what you’ve covered in this post, and perhaps your thoughts on such a co-operative arrangement?

    Thanks for the interesting post,

  3. If you’re logged into your Google account, this URL will grab all of your calendars in a ZIP file:

    http://www.google.com/calendar/exporticalzip

  4. @Rick Green: Go to the Calendar’s settings, they make available 3 private urls for the calendar. iCal, XML, and something else :)

    @mdebusk: Awesome, thanks! I have this script running as a cron job on my server, so I would just need to copy over a cookie and have wget use that, I believe. Sounds doable and maybe more efficient!

    @Jonathan: I use my account on a shared server (about 5 people, I believe) to do it. So that is where my backups go for things like this. But, I would be very very interested in setting up a co-op server that focused on providing FSS-compliant services for its members with a focus on transitioning people from non-FSS-compliant services. Wanna get one started? :)

  5. @mdebusk – I’d be very interested in getting one started… though I’ve partially been down this route before and not made huge progress, it would be good to try again! Drop me an email, and we could take it from there? I might even have some of the correspondence around from my previous attempts at this… might come in handy.

  6. @Greg – When you figure out which cookie, would you let us know? Right now, I just have the link bookmarked, and I back up whenever I think of it. I’d much rather use cron and wget. Thanks!

  7. @mdebusk: I’m working on the ability for wget to fetch “http://www.google.com/calendar/exporticalzip” but it doesn’t seem to be easy. After I found the right cookie, exported it from Firefox’s sqlite database of cookies, I realized it has an expiration date (like all cookies) and thus would only be temporary. So, I’m at a loss. :-/

Post a comment.