diff --git a/.metadata b/.metadata index ec7ef1c..6202819 100644 Binary files a/.metadata and b/.metadata differ 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