From 03351da5a091ad12e65bf04dac29f72115b3c847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20P=C3=A0mies?= Date: Tue, 26 Mar 2024 12:32:44 +0100 Subject: [PATCH] minor improvements --- backup_nc.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backup_nc.sh b/backup_nc.sh index fc7fd43..63ce8e0 100644 --- a/backup_nc.sh +++ b/backup_nc.sh @@ -12,6 +12,7 @@ # self-hosted server (https://gotify.net/). # # Tools needed: mysqldump, gzip. rsync, rdiff-backup, curl +# TODO: save current version 'sudo -u www-data php /var/www/html/nextcloud/occ config:system:get version' ################################################################################### PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin @@ -22,6 +23,7 @@ readonly GOTIFY_HOST="" readonly GOTIFY_PRIORITY=5 # backup db variables readonly BACKUP_DB_FILE="nextcloud-sqlbkp-"`date +\%Y\%m\%d`".sql" +#readonly BACKUP_DIR_FILE="nextcloud-dirbkp_"`date +\%Y\%m\%d`".tar.gz" readonly DB_HOST="" readonly DB_USER="" readonly DB_PASS="" @@ -31,6 +33,7 @@ readonly NEXTCLOUD_DATA="" readonly INCLUDE_LIST="include-list" # remote settings readonly REMOTE_SERVER="" +# TODO: Use $(hostname) "/path/to/example/"`hostname`"/nextcloud" readonly REMOTE_PATH="" readonly REMOTE_NC_DATA_FOLDER="files" readonly REMOTE_NC_DB_FOLDER="db" @@ -50,8 +53,8 @@ MESSAGE="Backup task init: **"`date +"%d/%m/%Y %H:%M:%S"`"** \r" # dump and backup db nextcloud handycat and rsync deleting origin mysqldump --single-transaction --verbose -h $DB_HOST -u $DB_USER -p$DB_PASS $DB_NAME > $BACKUP_DB_FILE gzip $BACKUP_DB_FILE -# TODO -# force create multiple paths (mkdir -p) if not exist with rsync trick + +# TODO: force create multiple paths (mkdir -p) if not exist with rsync trick # https://www.schwertly.com/2013/07/forcing-rsync-to-create-a-remote-path-using-rsync-path/ rsync -AaxzPh --remove-source-files "$BACKUP_DB_FILE.gz" "$REMOTE_SERVER:$REMOTE_PATH/$REMOTE_NC_DB_FOLDER"