Datensicherung von Kalendern und Adressbüchern von Nextcloud https://strobelstefan.org
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
README-DE.md Change Of URL 3 months ago
README.md Change Of URL 3 months ago
kalenderbackup.sh Change Of URL 3 months ago
storage-mount.sh Change Of URL 3 months ago
storage-umount.sh Change Of URL 3 months ago

README.md

kalenderbackup

🇩🇪 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 codeberg.org ➡️ https://codeberg.org/BernieO/calcardbackup

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 kalenderbackup.sh 3 shell scripts are used.

  • kalenderbackup.sh
  • storage-mount.sh - Mounts the external storage
  • storage-umount.sh - 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 (storage-mount.sh and storage-umount.sh).

The required variables are always passed via the "main script", kalenderbackup.sh, to the other two scripts (storage-mount.sh & storage-umount.sh ).

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 storage-mount.sh and storage-umount.sh.

Installation

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 https://codeberg.org/strobelstefan.org/kalenderbackup.git
    
  4. cd into that directory

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

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

    sudo ./kalenderbackup.sh
    
  7. Setup a cron job

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

Logrotate

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
        daily
        missingok
        notifempty
        compress
        delaycompress
        sharedscripts
        endscript
}

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


Follow Me

🐘 MastodonRSS


Kaffeespende

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.


Disclaimer

EN

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.

DE

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.