add backup of nextcloud dir
This commit is contained in:
parent
0262d93deb
commit
bb3e2ac6ec
|
@ -23,13 +23,13 @@ readonly GOTIFY_HOST="<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="<DB_HOST>"
|
||||
readonly DB_USER="<DB_USER>"
|
||||
readonly DB_PASS="<DB_PASS>"
|
||||
readonly DB_NAME="<DB_NAME>"
|
||||
# backup data variables
|
||||
readonly NEXTCLOUD_DATA="<NEXTCLOUD_DATA>"
|
||||
readonly NEXTCLOUD_DIR="<NEXTCLOUD_DIR>"
|
||||
readonly INCLUDE_LIST="include-list"
|
||||
# remote settings
|
||||
readonly REMOTE_SERVER="<REMOTE_SERVER>"
|
||||
|
@ -37,6 +37,7 @@ readonly REMOTE_SERVER="<REMOTE_SERVER>"
|
|||
readonly REMOTE_PATH="<REMOTE_PATH>"
|
||||
readonly REMOTE_NC_DATA_FOLDER="files"
|
||||
readonly REMOTE_NC_DB_FOLDER="db"
|
||||
readonly REMOTE_NC_DIR_FOLDER="dir"
|
||||
readonly BACKUP_PRESERVE_DAYS=60
|
||||
|
||||
# create include list file and set exclude logs
|
||||
|
@ -63,6 +64,11 @@ ssh $REMOTE_SERVER 'bash -s' << EOF
|
|||
find "$REMOTE_PATH/$REMOTE_NC_DB_FOLDER" -maxdepth 1 -mtime +$BACKUP_PRESERVE_DAYS -print -exec "rm" -R {} \;
|
||||
EOF
|
||||
|
||||
# rdiff-backup all dir of nextcloud
|
||||
rdiff-backup backup $NEXTCLOUD_DIR "$REMOTE_SERVER::$REMOTE_PATH/$REMOTE_NC_DIR_FOLDER"
|
||||
# clear X days old increments of backup dir
|
||||
rdiff-backup remove increments --older-than "${BACKUP_PRESERVE_DAYS}D" "$REMOTE_SERVER::$REMOTE_PATH/$REMOTE_NC_DIR_FOLDER"
|
||||
|
||||
# rdiff-backup all data of nextcloud
|
||||
OUT=$(rdiff-backup backup --print-statistics --include-globbing-filelist $INCLUDE_LIST $NEXTCLOUD_DATA \
|
||||
"$REMOTE_SERVER::$REMOTE_PATH/$REMOTE_NC_DATA_FOLDER")
|
||||
|
|
Loading…
Reference in New Issue