Last active
August 29, 2015 14:11
-
-
Save mikegreiling/a48e1d928bd81ba65cf4 to your computer and use it in GitHub Desktop.
Simple cron script to backup a Google Calendar to Amazon S3 (http://pixelcog.com/blog/2014/backup-gcal-to-s3/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export TZ=America/Chicago | |
export PATH=/usr/local/bin:$PATH # ensure path to aws exists for chrontab | |
# uncomment if needed | |
#export AWS_ACCESS_KEY_ID=ABCDEFGHIJKLMNOPQRST | |
#export AWS_SECRET_ACCESS_KEY=1234567890ABCDEFGHIJKLMNOPQRSTUV | |
bucket="my-bucket-name" | |
gcal_private_key="example.com_b6nffmu1v5v4jehogm9v5anll4%40group.calendar.google.com/private-4463bc3c4777e7d435cc385f9b3573a0" | |
cd $(mktemp -d 2>/dev/null || mktemp -d -t 'backup') # work around osx silliness | |
mkdir backup | |
curl https://www.google.com/calendar/feeds/$gcal_private_key/basic > backup/master-cal-backup.xml | |
curl https://www.google.com/calendar/ical/$gcal_private_key/basic.ics > backup/master-cal-backup.ics | |
tar -zcvf backup.tgz backup | |
aws s3 cp backup.tgz s3://$bucket/calendar-backup/$(date +%Y%m%d-%H%M).tgz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment