Backup Google Agenda on Debian
Google Agenda is very useful tool to synchronize an agenda between various users and hardwares. Synchronization errors can create lost, duplicated or edited events. This howto help to setup a frequent backup of Google Agenda. It ease the restoration of events in case of synchronization error.
This howto is tested on:
- Debian 6.0 Squeeze
Installation
Install the Google Agenda backup script:
command wget "https://raw.github.com/biapy/howto.biapy.com/master/various/backup-google-agenda" \
--quiet --no-check-certificate --output-document='/usr/bin/backup-google-agenda'
command chmod +x '/usr/bin/backup-google-agenda'
Create the script configuration file:
command wget "https://raw.github.com/biapy/howto.biapy.com/master/various/backup-google-agenda.conf" \
--quiet --no-check-certificate --output-document='/etc/backup-google-agenda.conf'
Set up a cron task running the script every 6 hours:
echo "# Google Agenda backup
0 */6 * * * root test -x /usr/bin/backup-google-agenda && /usr/bin/backup-google-agenda
" > '/etc/cron.d/backup-google-agenda'
Reload cron:
/etc/init.d/cron reload
Configuration
Add the agendas needing backup to the configuration file "/etc/backup-google-agenda.conf" with this format:
My agenda = https://www.google.com/calendar/feeds/biapy%40gmail.com/private-a5fsqdhvcx39450fdsdtjk8c12df32ee/basic
Where
- My agenda is the agenda name (any value is good)
- https://www.google.com/calendar/feeds/biapy%40gmail.com/private-a5fsqdhvcx39450fdsdtjk8c12df32ee/basic is the private URL of the agenda XML or ICS file, available in the agenda parameters.
Run the backup to check for errors:
command backup-google-agenda
Caractéristiques des sauvegardes
The backup-google-agenda tool backup the agendas in both XML and ICS formats. The backups are stored in Backup Manager archives folder if Backup Manager is installed. If Backup Manager is not available, the agendas archives are stored in "/var/archives".
List the agenda backup archives (only for Backup Manager default configuration):
command find '/var/archives' -name '*-google_agenda*'
The archives are kept for 30 days. The script automatically delete the agenda backups older than that.
If Backup Manager export is enabled, the agendas archives are exported with the others Backup Manager archives.
Thanks
- Thanks to gray-um.com for Backup your Google mail and calendar with Linux.
- Thanks to Shtark.fr for Lock file en shell (pour script bash).
- Thanks to Bash Hackers Wiki for Lock your script (against parallel run).