Datensicherung von Kalendern und Adressbüchern von Nextcloud
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Stefan b4fbd8ff31
Change Of URL
3 months ago
LICENSE Initial commit 2 years ago Change Of URL 3 months ago Change Of URL 3 months ago Change Of URL 3 months ago Change Of URL 3 months ago Change Of URL 3 months ago


🇩🇪 README in Deutsch

What is the purpose of "kalenderbackup"?

This script calls calcardbackup from BernieO to automatically backup address books and calenders of your Nextcloud instance.

Hey, calcardbackup does the same as calcardbackup so why should I use "kaldenderbackup"?

That´s a good question! calcardbackup is a very powerful tool which provides a lot of features. So here are my BUTs to create kalenderbackup 😊

The script provides the following features:

  1. you can call the script from any location
  2. creates a detailed log file
  3. mounts an external storage which is attached to your server
  4. calls calcardbackup to export address books and calendars
  5. stores the export of your address books and contacts on the external storage
  6. sends the exports of address books and calenders, log files and this script via e-mail to a defined e-mail address in a single message
  7. checks for a new version of calcardbackup

That sounds very complicated!

You can easily customize the script because it is

  • easy to understand
  • uses variables which you can alter as needed

Sounds like you created a double backup with the script?

Yes, you are right! A very nice feature is the double layer of security the script provides for your precious address books and calenders,

  • it stores the backup on an external storage
  • it sends the export to a defined e-mail address

so you have TWO backups on TWO separate storages which you can easily restore.

There are many other ways to store your exports on a physically separated device, too. Here are some examples:

What is required to use "kalenderbackup"?

Firstly, you need the most important calcardbackup which is also maintained on ➡️

Secondly you have to have a working Mail Transfer Agent (MTA) like Postfix and an e-mail client like mutt installed on your server. Of course you find a detailed manual how to setup both on my website: ➡️ E-Mail-Versand für den Raspberry Pi konfigurieren

Why multiple shell scripts?

In the new version of 3 shell scripts are used.

  • - Mounts the external storage
  • - Umounts the external storage

On a Raspberry Pi several scripts are used for different backup tasks, but each of them mounts a different external storage medium. For mounting and unmounting always the two scripts are used ( and

The required variables are always passed via the "main script",, to the other two scripts ( & ).

Shellskript Variable an anderes Skript übergeben

For more details please refer to
➡️ Shellskript - Variablen an andere Skripte übergeben

imagebackup, a script to backup the entire SD card of a Raspberry Pi, also uses and


Gladly, that is very simple!

This is a very short installation instruction. A more detailed one you can find on my website
➡️ Nextcloud Datensicherung von Kalendern und Adressbüchern automatisch erstellen

  1. Make sure all dependencies for your external storage, MTA, etc. are dissolved.

  2. Create script directory

    sudo mkdir /etc/scripts
  3. Clone the entire Git repository to your hard disk (optional)

    git clone
  4. cd into that directory

    cd /etc/scripts/kalenderbackup
  5. Set the correct permissions

    sudo chown root:root
    sudo chmod 0600
    sudo chmod +x
  6. Test run

    sudo ./
  7. Setup a cron job

    # Calender & Address book backup
    00 20 * * * /bin/bash /etc/scripts/


The script creates the log file in the /var/log directory. Once the file exists, the logs will continuously write into the file. This can cause the file to become very large and waste disk space.

To avoid manually deleting the file, a small logrotate script can be created to manage the log file.

Show installed version

logrotate --version

Install logrotate

sudo apt install logrotate

A new file must be created in the directory /etc/logrotate.d:

sudo nano /etc/logrotate.d/kalenderbackup

The contents of the file may look like this:

/var/log/kalenderbackup.log {
        rotate 4

For more info on logrotate see the man logrotate man pages.

Follow Me

🐘 MastodonRSS


Du findest meine Vorlage hilfreich, dann kannst du mir gerne einen Kaffee ausgeben.

😊 😎 bc1qfuz93hw2fhdvfuxf6mlxlk8zdadvnktppkzqzj 😄

You like template, then feel free to buy me a coffee.



The working methods described here are based on my personal experience and my personal thought processes. I do not guarantee the results; trying out and implementing the described procedures is entirely at your own risk and responsibility.

Therefore, please make a backup before making any changes to your system or configuration so that you can restore it if the worst comes to the worst.


Die hier geschilderten Arbeitsweisen basieren auf meiner persönlichen Erfahrung und meinen persönlichen Gedankengängen. Ich übernehme keine Garantie für die Resultate; Ausprobieren und Implementieren der beschriebenen Vorgehensweisen erfolgt ausschließlich auf eigene Verantwortung und Gefahr.

Bitte erstellt deshalb vor jeder Änderung an eurem System oder Konfiguration ein Backup, damit ihr im Fall der Fälle eine Wiederherstellung durchführen könnt.