From 7799e7a11f6a225673b3ace5f7791e600250e6fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Zolt=C3=A1n?= Date: Tue, 17 Feb 2026 20:06:44 +0100 Subject: [PATCH] In Nextcloud recipe the storage_backup now excludes the documents if the storage_gitbackup is active. --- .metadata | Bin 22101 -> 22101 bytes .../tools/backup.d/storage_backup.sh | 13 +++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.metadata b/.metadata index ec7ef1c75a3032aeef5900ae81ad6e651cb3f9bf..620281994edf6fb13859b694bf735fc0ef314aa7 100644 GIT binary patch delta 63 zcmcb*hVkke#tp6&4C=Rm02ESs$@>y$S*s2fxYzP2O^x4Klt!& J?$bH02>=AB6S)8Y diff --git a/.recipes/nextcloud_mariadb/tools/backup.d/storage_backup.sh b/.recipes/nextcloud_mariadb/tools/backup.d/storage_backup.sh index 8b017e8..cb7b847 100644 --- a/.recipes/nextcloud_mariadb/tools/backup.d/storage_backup.sh +++ b/.recipes/nextcloud_mariadb/tools/backup.d/storage_backup.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# A service script to backup the relevant user's storage (data folder) +# A service script to backup the relevant user's storage (apps, data, themes) # of a docker-composed Nextcloud instance. Creates a tarball in # $BASE_DIR/storage/backups/tarballs folder (by default). An optional # parameter may change the target folder. @@ -9,6 +9,9 @@ # # Author: Kovács Zoltán # License: GNU/GPL 3+ https://www.gnu.org/licenses/gpl-3.0.en.html +# 2026-02-07 v0.2 +# new: Excludes the documents if the storage_gitbackup is active. +# mod: custom_apps and themes folders have been added. # 2025-11-24 v0.1 Initial version. # Accepted environment variables and their defaults. @@ -28,6 +31,7 @@ MSG_NOLOCATE="Cannot locate the Nextcloud container." # Other initialisations. # BACKUPDIR="storage/backups/tarballs" # Folder to dump within +GITBACKUP="storage_gitbackup.sh" # Git backup utility SERVICENAME="nextcloud" # The composed Nextcloud service USER=${USER:-LOGNAME} # Fix for cron enviroment only YMLFILE="docker-compose.yml" @@ -112,11 +116,16 @@ NCCONTAINER="$("$DOCKER" inspect -f '{{.Name}}' $(cd "$BASE_DIR"; "$DOCKER_COMPO # Gives up here if failed. if [ -z "$NCCONTAINER" ]; then echo "$MSG_NOLOCATE" >&2; exit 1; fi +# Excludes the documents if the GITBACKUP is active. +DOCUMENTS="data" +[[ -n $(which "$GITBACKUP") ]] && DOCUMENTS="" # it is an executable somewhere in the path +[[ -x "$SCRPATH/$GITBACKUP" ]] && DOCUMENTS="" # it is an executable in the current directory + # Tries the FS backup. if [ -w "$BACKUPDIR" ]; then BACKUP_NAME=$NCCONTAINER.$("$DATE" '+%Y%m%d_%H%M%S').$("$HOSTNAME") "$DOCKER" exec $NCCONTAINER sh \ - -c "cd /var/www/html; tar cz data" \ + -c "cd /var/www/html; tar cz custom_apps $DOCUMENTS themes" \ > "$BACKUPDIR/$BACKUP_NAME.tgz" 2>>"$BACKUPDIR/$BACKUP_NAME.log" fi