Automatic backup of calendar entries

I’d like an automated way of backing up all the calendar entries for all the users on a Nextcloud

  • able to set backup intervals (minutes, hours, days, weeks)
  • able to set rolling window so that older backups are deleted to make room for current ones
  • backups should be in the form of .ICS files that can be easily imported to restore or used elsewhere
  • able to write backups to external storage for safe keeping
  • able to restore only select calendars, user specific
  • user can wind back calendar changes (within the rolling window set by admin)

I really love Nextcloud, but I’ve lost entire team calendars more than once and the Natives will want my head on a pike if I loose it ever again. Please build this for me!

I’m sorry, but for companies the linked script is not practicable: Think about 300 users have their own personal calendar and maybe every user is member of 2 group calendars.
Additional there is a problem with data protection - the “backup”-user is able to read all entries of all calendars. No data protection officer would allow to use such a script for backup reasons.

Therefore I would like to see if somebody of NC implements a occ-command locally.

You can backup the whole data base, everything is included there. However, all data is readable at all time for an admin user or in the backup.

You could perhaps get a occ-command, but then you also would have all the data for each calendar in a clear-text file how does this solve your concerns?

I agree with you that the whole data is in the database and with this backup you will be able to restore every calendar (see the blog from “nickvergessen” for the steps to restore it:

However, currently I have to restore every one or two weeks a calendar for an user in a similar way for another groupware solution. And it is not very funny, besides it takes more than one hour until the data is restored.

An occ-command may not mean, that the backup-files will be stored as clear-text files. It does only mean, that the backup-process is started on a console locally. That means, there are enough permissions to

  • ensure that the currently logged in user is allowed to start the process
  • access the database
  • store files locally
  • etc.

Maybe the occ-command will get all calendar-data and store it a separate backup-database in a simple way to restore it later (yes, I know that this is not, what the original author wrotes) by a mouse click on the administration console.

Is there a particular reason why this is required?

For more occ commands, it is better to put a feature request on
However, it should be clear that this is the best solution. If this restoring is required because of an unclear calendar-interface, it would be better to improve the interface.

The problem sits in front of the display: the user. Either they delete an entry which should not be deleted (in this case may help) or they synchronize a private calendar into group calendar by using outlook and the caldav synchronizer.
However, in both cases would help a simple restore path much.

1 Like