Calcardbackup: bash script to backup ownCloud calendars and addressbooks as *.ics/*.vcf files

contacts
calendar

#1

I like to backup my ownCloud calendars and addressbooks as .ics/.vcf files, because it is very easy to restore: just import the backed up .ics/.vcf file to the server or a client and the accidentally deleted data is back online.

Therefore I initially wrote a bash script with hardcoded links for my installation. Two friends were interested and so I improved the script to be more generic which possibly makes it interesting for other users as well.

The script downloads all available calendars/addressbooks belonging to certain users from a ownCloud instance as .ics/.vcf files. Usernames and according passwords have to be given in a separate file. All downloaded files are then compressed to a single file with the current date in the filename.

It works with all ownCloud versions >= 5.0 (and Nextcloud as well) and has been tested under Debian Wheezy and Jessie. Of course shell access to the server is needed. Configuration is quite simple: in most cases the path to the ownCloud directory sufficient. It is not necessary to run the script with root privileges - in default configuration it only needs to have read access to ownClouds configuration file 'config.php'. At no point any data leaves the server.

If that sounds interesting to you, you are welcome to use it:

Best wishes,
Bernie_O


Calendar - one calendar can't be synced and downloaded
Calendar migration from 8.2.11 to 10.0.10 without upgrading ownCloud itself
#2

I just released version 0.2.0 of the script, which comes with a new option to include shared addressbooks/calendars to the backup. This may be used to provide only one username + password in the credentials-file to whom all addressbooks/calendars (to be backed up) are shared. A just for this purpose created new user would make sense. If the file gets somehow in wrong hands, only the credentials of this single user will be compromised.

Drawback of this approach is: added addressbooks/calendars will not be backed up, unless they are shared with that user. That's the price for improved security...

Have a look at the section "About the option -i / --include-shares" in the file README.md in the github-repo for a detailed "How to". There you can also find some usage examples:

Cheers, Bernie_O


Backup for contacts and calendars
#3

The new version of the script calcardbackup brings a big improvement regarding security: it does not need cleartext passwords or usernames of the ownCloud users anymore, because the script fetches all data directly from the database. Due to the fact that the data is not anymore retrieved via http(s) request from the ownCloud webinterface, it is now possible to backup calendars and addressbooks from broken ownCloud instances as long as the database is available!


#4

Is this portable between future versions of ownCloud? The layout of the db-tables might evolve.


#5

If the table layout changes, the script will need to adapt.