No worries about Magento 1 End-of-Life - all our Magento 1 Extensions will be supported further and actively developed!


Notes of a Magento Developer's Life

How to backup your CalDav calendar with a Raspberry Pi?

One of the basic things that you as a developer must know is how to handle a version control system like git, subversion, Mercurial, you name it..

Once that you have grasped all the benefits of such a version control system, you won’t ever miss that. But you begin to recognize to miss it in a lot of other applications where you want to e.g. track the history.
One of those applications for me is my calendar. Especially if you share your calendar with other people (perhaps not with IT background) a lot of things begin to happen, like missing appointments, moving appointments around, timezone issue and so on.

So one of the basic requirements for me was to backup the CalDav calendar regularly. Unfortunately most of the email providers that offer calendar functionality do not offer such a service that’s why I implemented it myself with the help of a Raspberry Pi 3B.

The script uses the open source software cadaver and should work with CalDAV calendars in general, in my case I use it with calendars from 1&1 email.

All you have to do is install the cadaver client according to the documentation and create a new script e.g. with the following content:

# @see


/bin/cat <<EOM >~/.netrc
login ${CALDAV_USER}
password ${CALDAV_PASSWD}

set -e

mkdir -p /tmp/calendar
cd /tmp/calendar

cadaver $CALDAV_URL << EOA
mget *.ics

FILENAME=/tmp/backups/calendar-${CALDAV_USER}-`date +%Y.%m.%d`.tar.bz2

cd ..
tar cvfj $FILENAME calendar
rm -r /tmp/calendar
rm ~/.netrc

echo "Backup file $FILENAME successfully completed on `date`."

Then execute the script via e.g. crontab on your Raspberry Pi (or of course any other linux system in your network) with the following command: https://your.caldav.url user password

After running this script the resulting backup file will be saved to /tmp/backups.

Posted in