{"id":13434599,"url":"https://github.com/DecaTec/Nextcloud-Backup-Restore","last_synced_at":"2025-03-17T19:31:02.502Z","repository":{"id":217167917,"uuid":"103020203","full_name":"DecaTec/Nextcloud-Backup-Restore","owner":"DecaTec","description":"Moved to codeberg.org - https://codeberg.org/DecaTec/Nextcloud-Backup-Restore - Bash scripts for backup/restore of Nextcloud","archived":true,"fork":false,"pushed_at":"2022-02-13T16:26:07.000Z","size":80,"stargazers_count":126,"open_issues_count":0,"forks_count":35,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-08-01T03:13:42.783Z","etag":null,"topics":["backup","bash","nextcloud","restore","script"],"latest_commit_sha":null,"homepage":"https://decatec.de","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DecaTec.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-09-10T10:13:34.000Z","updated_at":"2024-07-13T14:04:12.000Z","dependencies_parsed_at":"2024-01-14T22:50:46.032Z","dependency_job_id":"09614f9d-6ff2-453f-aafa-0d4d7123bafe","html_url":"https://github.com/DecaTec/Nextcloud-Backup-Restore","commit_stats":null,"previous_names":["decatec/nextcloud-backup-restore"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DecaTec%2FNextcloud-Backup-Restore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DecaTec%2FNextcloud-Backup-Restore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DecaTec%2FNextcloud-Backup-Restore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DecaTec%2FNextcloud-Backup-Restore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DecaTec","download_url":"https://codeload.github.com/DecaTec/Nextcloud-Backup-Restore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221699020,"owners_count":16865967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","bash","nextcloud","restore","script"],"created_at":"2024-07-31T03:00:18.543Z","updated_at":"2024-10-27T15:31:27.880Z","avatar_url":"https://github.com/DecaTec.png","language":"Shell","funding_links":[],"categories":["Utility"],"sub_categories":["Windows Manager"],"readme":"\u003ca href=\"https://codeberg.org/DecaTec/Nextcloud-Backup-Restore\"\u003e\n    \u003cimg alt=\"Get it on Codeberg\" src=\"https://get-it-on.codeberg.org/get-it-on-blue-on-white.png\" height=\"60\"\u003e\n\u003c/a\u003e\n\n### :warning: Archived, moved to Codeberg: https://codeberg.org/DecaTec/Nextcloud-Backup-Restore :warning:\n\n[![release](https://img.shields.io/badge/dynamic/json.svg?label=release\u0026url=https://codeberg.org/api/v1/repos/DecaTec/Nextcloud-Backup-Restore/releases\u0026query=$[0].tag_name)](https://codeberg.org/DecaTec/Nextcloud-Backup-Restore/releases)\n\n# Nextcloud-Backup-Restore\n\nThis repository contains two bash scripts for backup/restore of [Nextcloud](https://nextcloud.com/).\n\nIt is based on a Nextcloud installation using nginx and MariaDB (see the (German) tutorial [Nextcloud auf Ubuntu Server 20.04 LTS mit nginx, MariaDB, PHP, Let’s Encrypt, Redis und Fail2ban](https://decatec.de/home-server/nextcloud-auf-ubuntu-server-20-04-lts-mit-nginx-mariadb-php-lets-encrypt-redis-und-fail2ban/)).\n\n## General information\n\nFor a complete backup of any Nextcloud instance, you'll have to backup these items:\n- The Nextcloud **file directory** (usually */var/www/nextcloud*)\n- The **data directory** of Nextcloud (it's recommended that this is *not* located in the web root, so e.g. */var/nextcloud_data*)\n- The Nextcloud **database**\n- Maybe a local external storage mounted into Nextcloud\n\nThe scripts take care of these items to backup automatically.\n\n## Requirements\n\n- *pigz* (https://zlib.net/pigz/) when using backup compression. If not installed already, it can be installed with `apt install pigz` (Debian/Ubuntu). If not available, you can use another compression algorithm (e.g. gzip)\n\n## Important notes about using the scripts\n\n- After cloning or downloading the scripts, these need to be set up by running the script `setup.sh` (see below).\n- If you do not want to use the automated setup, you can also use the file `NextcloudBackupRestore.conf.sample` as a starting point. Just make sure to rename the file when you are done (`cp NextcloudBackupRestore.conf.sample NextcloudBackupRestore.conf`)\n- The configuration file `NextcloudBackupRestore.conf` has to be located in the same directory as the scripts for backup/restore.\n- The scripts assume that Nextcloud's data directory is *not* a subdirectory of the Nextcloud installation (file directory). The general recommendation is that the data directory should not be located somewhere in the web folder of your webserver (usually */var/www/*), but in a different folder (e.g. */var/nextcloud_data*). For more information, see [here](https://docs.nextcloud.com/server/latest/admin_manual/installation/installation_wizard.html#data-directory-location-label).\n- However, if your data directory *is* located under the Nextcloud file directory, you'll have to change the script configuration (file `NextcloudBackupRestore.conf` after running `setup.sh`) so that the data directory is not part of the backup/restore (otherwise, it would be copied twice).\n- The scripts only backup the Nextcloud data directory and can backup a local external storage mounted into Nextcloud. If you have any other external storage mounted in Nextcloud (e.g. FTP), these files have to be handled separately.\n- The scripts support MariaDB/MySQL and PostgreSQL as database.\n- You should have enabled 4 byte support (see [Nextcloud Administration Manual](https://docs.nextcloud.com/server/latest/admin_manual/configuration_database/mysql_4byte_support.html)) on your Nextcloud database. Otherwise, when you have *not* enabled 4 byte support, you have to edit the restore script, so that the database is not created with 4 byte support enabled (variable `dbNoMultibyte`).\n\n## Setup\n\n1. Clone the repository: `git clone https://codeberg.org/DecaTec/Nextcloud-Backup-Restore.git`\n2. Set permissions:\n    - `chown -R root Nextcloud-Backup-Restore`\n    - `cd Nextcloud-Backup-Restore`\n    - `chmod 700 *.sh`\n3. Call the (interactive) script for automated setup (this will create a file `NextcloudBackupRestore.conf` containing the desired configuration): `./setup.sh`\n4. **Important**: Check this configuration file if everything was set up correctly (see *TODO* in the configuration files's comments)\n5. Start using the scripts: See sections *Backup* and *Restore* below\n\nKeep in mind that the configuration file `NextcloudBackupRestore.conf` hast to be located in the same directory as the scripts for backup/restore, otherwise the configuration will not be found.\n\n## Backup\n\nIn order to create a backup, simply call the script *NextcloudBackup.sh* on your Nextcloud machine.\nIf this script is called without parameter, the backup is saved in a directory with the current time stamp in your main backup directory: As an example, this would be */media/hdd/nextcloud_backup/20170910_132703*.\nThe backup script can also be called with a parameter specifiying the main backup directory, e.g. *./NextcloudBackup.sh /media/hdd/nextcloud_backup*. In this case, the directory specified will be used as main backup directory. \n\nYou can also call this script by cron. Example (at 2am every night, with log output):\n\n`0 2 * * * /path/to/scripts/Nextcloud-Backup-Restore/NextcloudBackup.sh  \u003e /path/to/logs/Nextcloud-Backup-$(date +\\%Y\\%m\\%d\\%H\\%M\\%S).log 2\u003e\u00261`\n\n## Restore\n\nFor restore, just call *NextcloudRestore.sh*. This script expects at least one parameter specifying the name of the backup to be restored. In our example, this would be *20170910_132703* (the time stamp of the backup created before). The full command for a restore would be *./NextcloudRestore.sh 20170910_132703*.\nYou can also specify the main backup directory with a second parameter, e.g. *./NextcloudRestore.sh 20170910_132703 /media/hdd/nextcloud_backup*.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDecaTec%2FNextcloud-Backup-Restore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDecaTec%2FNextcloud-Backup-Restore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDecaTec%2FNextcloud-Backup-Restore/lists"}