Created
December 26, 2024 13:52
-
-
Save dojoe/eb690701b6e10b30b5e6db46e35715df to your computer and use it in GitHub Desktop.
NextCloud backup using restic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MYDIR=$(readlink -f $(dirname $0)) | |
$MYDIR/occ maintenance:mode --on | |
docker container exec nextcloud-db mysqldump --single-transaction --default-character-set=utf8mb4 -u nextcloud -p<db password> nextcloud > /var/nextcloud/nextcloud-db.dump | |
RESTIC_PASSWORD=<repo password> $MYDIR/restic -r <repo URL> backup /root/compose/nextcloud /var/nextcloud/nextcloud-db.dump /var/nextcloud/site/{data,themes,config} | |
rm /var/nextcloud/nextcloud-db.dump | |
$MYDIR/occ maintenance:mode --off |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment