Backup&Export all Contacts and Calendar (automated)

I’ve tried this with Calcardbackup as documented here: Nextcloud · syncloud/platform Wiki · GitHub

Question:

This documents how to setup an automated backup.
Based on this my idea for the cronjob which would export the backup to my nextcloud files every day looks like this:
0 4 * * * sudo -u nextcloud PATH=“${PATH}:/snap/bin” /tmp/calcardbackup/calcardbackup /var/snap/nextcloud/current/nextcloud -p -o “/opt/disk/internal/nextcloud/ME/files/C_Data/Backups_Cloud/CalCard” -r 10 > /var/log/calcardbackup.log 2>&1
Would this work? Maybe the Syncloud wiki entry I mentioned in the beginning could be expanded to include the automation.

I have no background in coding/terminal and all that and tried really hard to learn all this by myself but it is getting a little complicated here. Would appreciate any help! :slight_smile:

This export script is more like one time use when migrating away from nextcloud or something I do not even remember now.

Let me ask you a few questions.

  1. What exactly are you trying to achieve?
  2. Is Syncloud Backup (Settings - Backup) is not good for that? Why?

Syncloud backup: Backup · syncloud/platform Wiki · GitHub

I see.

  1. My main goal is to streamline/automate my backups. The easiest way for me to do this is having the relevant backup files synced to my PC which gets backuped automatically to an HDD. Currently the files synced via nextcloud do not contain the nextcloud contacts or calendar.

  2. Not really, because the Syncloud Backups can’t be used as easily and universally to restore certain contacts/calendars and they take up much more space.

That’s why I’m trying to do the cronjob thing.

But now that we’re talking about it:
3. Would it be possible for us to save the Syncloud Backup files to a Nextcloud User’s files so they are automatically synced to client devices? Backups on the Syncloud server only help with certain scenarios, not with drive failure etc.

I set up a Cronjob using the following:
sudo touch /var/log/calcardbackup.log
sudo chown nextcloud:nextcloud /var/log/calcardbackup.log

sudo crontab -u nextcloud -e

and added the following line to the crontab file:
0 4 * * * PATH="${PATH}:/snap/bin" /tmp/calcardbackup/calcardbackup /var/snap/nextcloud/current/nextcloud -p -o “/opt/disk/internal/nextcloud/ME/files/CalContBackup” > /var/log/calcardbackup.log 2>&1

I’ll check if it worked tomorrow and will report back. I’m just unsure about this part: PATH=“${PATH}:/snap/bin”

Would it be possible for us to save the Syncloud Backup files to a Nextcloud User’s files so they are automatically synced to client devices? Backups on the Syncloud server only help with certain scenarios, not with drive failure etc.

I would rather keep backups separate from app data for now to not interfere in any way.
For disk failure scenario we have a device morror feature explained here: Device Mirror · syncloud/platform Wiki · GitHub

Makes sense by default, I guess. Maybe I could add a cronjob to copy the backup files to my Nextcloud user files, though.
Alternatively, I have been able to configure FreeFileSync to copy the backup folder to my PC regularly via SFTP.

I opened a different discussion concerning the disk failure scenario - shouldn’t be too hard to do scheduled backups to a different disk without having to run two Syncloud instances?
My idea is to use FreeFileSync on a User’s PC to backup all the important files regularly. This way one wouldn’t have to physically access the Syncloud device for every backup.
I’d be happy to write something for the wiki once we figured out an easy way.