Scripts to do backups of nextcloud data, database and nextcloud files
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nextcloud-backups/backup_dir.sh

22 lines
868 B

#!/bin/bash
PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
#Use backup_dir.sh <logfile> <path_local_backups> <remote_server> <remote_path>
LOG_FILE=$1
BACKUP_FILE="nextcloud-dirbkp_"`date +\%Y\%m\%d`".tar.gz"
EXCLUDE_DIRS="/path/to/nextcloud/data"
EXCLUDE_DIRS="${EXCLUDE_DIRS} /path/to/nextcloud/"
PATH_LOCAL_BACKUPS=$2
REMOTE_SERVER=$3
REMOTE_PATH=$4
echo "\n[NEW BACKUP TASK] Backup install dir nextcloud...\n" >> $LOG_FILE
# tar and backup install dir nextcloud, excluding data folder and finally rsync deleting origin
tar zcvf $PATH_LOCAL_BACKUPS$BACKUP_FILE --exclude=$EXCLUDE_DIRS
rsync -AaxzPh --remove-source-files $PATH_LOCAL_BACKUPS$BACKUP_FILE "$REMOTE_SERVER:$REMOTE_PATH" >> $LOG_FILE
echo "[DONE BACKUPS] handycat dir nextcloud backup completed!" >> $LOG_FILE
echo "########################################################" >> $LOG_FILE