63 lines
1.6 KiB
Bash
63 lines
1.6 KiB
Bash
local_path="/mnt/barracuda/Nextcloud/"
|
|
backup_path="nextcloud"
|
|
borg_extra_args=('--exclude=appdata*/preview' '--exclude=updater*')
|
|
|
|
backup_pre() {
|
|
echo "Enable maintenance mode"
|
|
_maintenance_mode on
|
|
}
|
|
|
|
backup_post() {
|
|
echo "Disable maintenance mode"
|
|
_maintenance_mode off
|
|
}
|
|
|
|
|
|
_maintenance_mode() {
|
|
ssh backupuser@trex-nextcloud.ibk.netdeneb.com \
|
|
NEXTCLOUD_PHP=/usr/bin/php NEXTCLOUD_PHP_CONFIG=/etc/webapps/nextcloud/php.ini \
|
|
sudo --preserve-env="NEXTCLOUD_PHP,NEXTCLOUD_PHP_CONFIG" \
|
|
occ maintenance:mode --${1:-on}
|
|
}
|
|
|
|
## old (reflink+rsync) method
|
|
#local_path="/mnt/barracuda/Nextcloud/"
|
|
#rsync_extra_args=('--exclude=appdata*/preview' '--exclude=updater*')
|
|
#_backup_path_base="Nextcloud/"
|
|
#
|
|
#backup_pre() {
|
|
# echo "Enable maintenance mode"
|
|
# _maintenance_mode on
|
|
#
|
|
# #_backup_subpath="${timestamp}_inc"
|
|
# #backup_path="$_backup_path_base/$_backup_subpath/mnt/nextcloud/"
|
|
#
|
|
# #_copy_last "$_backup_subpath"
|
|
#}
|
|
#
|
|
#_copy_last() {
|
|
# echo "Create new backup directory"
|
|
# ssh "$backup_user"@"$backup_host" <<EOF
|
|
# next="$1"
|
|
# if [ -z "\$next" ]; then
|
|
# echo "\\\$next not specified"
|
|
# fi
|
|
#
|
|
# cd "\$HOME/$_backup_path_base"
|
|
#
|
|
# last="\$(find . -maxdepth 1 -name '*_inc' -type d | sort | tail -n1)"
|
|
#
|
|
# echo "\$last" "\$next"
|
|
#
|
|
# if [ "\$next" == "\$last" ]; then
|
|
# echo "\$next == last timestamp; aborting"
|
|
# exit 2
|
|
# fi
|
|
# if [ -e "\$next" ]; then
|
|
# echo "\$next already exists; using"
|
|
# exit 0
|
|
# fi
|
|
#
|
|
# cp -rp --reflink "\$last" "\$next"
|
|
#EOF
|
|
#}
|