One new feature was added:
The scripts for backup/restore can now be initialized by a âsetup scriptâ. By running setup.sh, some information are gathered (user input) and all the other variables are obtained using OCC.
This way it should be much easier to install these scripts so that they fit to your Nextcloud installation.
However, you should never rely on the setup script. Always check the backup/restore scripts (line by line) before running these for the first time.
Amazing script! I only have one problem: I cant locate the web server name! Sorry if its a silly question but i m new to all of these. I have to add i ve installed nextcloud 19 through snap.
linux mint 19.3 xfce. I really donât know which one, both âcant be foundâ through systemctl.
It does work with my snap installation since ive edited the script to point to the right directories.
Yes, the scripts are for a âstandaloneâ installation of Nextcloud only. With Snap you have a ready to use package which is âall in oneâ. I donât have any experience with Snap, but I guess that you have to back up the whole Snap package.
I think you cannot use these scripts for this task.
Linux Mint:
If linux mint, please do not use snap https://www.omgubuntu.co.uk/2020/06/enable-snap-apps-linux-mint-20
Please use Ubunut LTS or Debian (server) versions an not the desktop releases of mint.
Mint is not a good idea for a server service like nextcloud.
If you want to install nextcloud on your desktop:
Install Ubunutu LTS or Debian Buster on your desktop and not mint.
Ok sorry. Linux MInt 19 is also a LTS release and in 2023 you must use Snap without official snap support on Linux Mint. This is a lot of time.
But Mint 19 based on the old Ubuntu 18.04 LTS. I think with the next nextcloud version (20) perhaps at the end of 2020 you must add from a PPA software e.g. newer php- or other software or migratie to Linux Mint 20 (without Snap), to Ubuntu 20.04 LTS (with snap) or Debian Buster (10) (without snap).
Dear @DecaTec, thank you so much for your helpful backup scripts!
Do you mind if I ask you a question? Iâm getting an error that I donât fully understand when executing NextcloudBackup.sh :-/
I managed to get my own NC instance up and running for family and friends around a year ago and now I finally got around to setting up and offsite backup using a Raspberry Pi with external HDD which is peered over wireguard with the NC server.
So naturally, I ran your setup.sh and pointed the destination to pi@[wireguard-IP]:[port]/media/pi/Element/Backup/Nextcloud.
I ran
ping [wireguard-IP]
beforehand to see if it still worked. It did. So I opened a screen and executed NextcloudBackup.sh. This is my output:
Backup directory: pi@[wireguard-IP]:[port]/media/pi/Element/Backup/Nextcloud
Set maintenance mode for Nextcloud...
Maintenance mode enabled
Done
Stopping web server...
Done
Creating backup of Nextcloud file directory...
pi@[wireguard-IP]'s password: ***************
bash: /usr/lib/tar/rmt: No such file or directory
tar: pi@[wireguard-IP]\:[port]/media/pi/Element/Backup/Nextcloud/20201231_131320/nextcloud-filedir.tar: Cannot open: Input/output error
tar: Error is not recoverable: exiting now
Done
Creating backup of Nextcloud data directory...
pi@[wireguard-IP]'s password:
and then that repeats until I cancel the script.
Do you know what could cause this behavior? Iâm inclined to believe that the script canât write to my remote storage as indicated by the Cannot open: Input/output error bit shown above, but rsyncing multiple directories of several GB each into remote directories that rsync had to create first was no problem.
Also, two other things I noticed:
right now, NextcloudBackup.sh creates backups before checking if the destination is writeable, yes? It might be an idea to have the script check whether the destination (be it a local external HDD, a local folder or a remote storage) is ready first before creating backups.
I had to fiddle a bit with trailing slashes in the destination folders because I kept seeing things like [remote_dir]/Nextcloud//20201231_131320, which, I assume, is likely to cause errors?
I think that this line is the cause of the problem. But honestly, I cannot tell you why itâs trying to use this lib, maybe this has something to do with wireguard?
The double slashes may occur when you call the script with a backup destination folder with a trailing slash. But this shouldnât be a problem at all.
Huh. Yeah, I was wondering why it would need to look into /usr/lib/tar/rmt. I dabbled a little further and it seems now that this particular problem only appears when I append the port number to backupMainDir. So
Creating backup of Nextcloud file directory...
pi@[wireguard-IP]'s password:
bash: /usr/lib/tar/rmt: No such file or directory
tar: pi@[wireguard-IP]\:[port]/media/pi/Element/Backup/Nextcloud//20201231_145502//nextcloud-filedir.tar: Cannot open: Input/output error
tar: Error is not recoverable: exiting now
Done
I think this is the correct syntax when giving the script a remote storage, however, since omitting the port invariably produces locally stored backups. The script opens a new dir in the dir I started the process in and then tars everything there. It also does not ask me for an ssh password, so my comment about making sure the destination directory is moot, obviously
So, in essence, I guess I canât really use the script given my backup storage solution?
Hi, i installed Nextcloud on Debian 11 and apache2. When i start the script, they make a backup of data and nextcloud files, but not the database, and the nextcloud stay in maintenance and apache2 would not be automatically restarted. I checked the configs, and i manually changed mysql to mariadb, but same result. So i canât find what is wrong. Any idea how i can check it?
There should be an error message when the script is run.
When only the DB is missing from the backup, you could manually execute the single steps from the script in order to get the exact line where an error is thrown.
The last message ist this:
17:54:42: Creating backup of Nextcloud data directoryâŠ
Ignoring Nextcloud updater backup directory
tar: ./back/20220930_175006/nextcloud-datadir.tar.gz: file changed as we read it
root@cloud-02:/skript/Nextcloud-Backup-Restore#
OuhâŠNow i understand itâŠ
The backup directory must not be mounted in the data directory of the nextcloud⊠i mounted in /data/back and the /data is the data directory of nextcloud. Nice to know