40 lines
1.5 KiB
Bash
Executable File
40 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# this one makes a copy of the whole /var/www/html from sbz
|
|
#
|
|
# to recover nextcloud data see: https://docs.nextcloud.com/server/13/admin_manual/maintenance/restore.html
|
|
#
|
|
# rsync args:
|
|
# -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
|
|
# -r, --recursive recurse into directories
|
|
# -l, --links When symlinks are encountered, recreate the symlink on the destination.
|
|
# -h, --human-readable Output numbers in a more human-readable format.
|
|
|
|
PORT="42523"
|
|
KEY="./sbz_keyless"
|
|
USER_AT_HOST="rob@spaceboyz.net"
|
|
|
|
SBZ_MOUNT_PATH=/home/rob/tmp_mnt
|
|
SOURCE_PATH=/var/www/html/marker
|
|
DEST_PATH=/tmp/nextcloud-rsync/
|
|
NEXTCLOUD_PATH=/var/www/html/nextcloud
|
|
|
|
|
|
# mount my lxc container into my home on sbz
|
|
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo mount /dev/mapper/vms-home--rob $SBZ_MOUNT_PATH"
|
|
|
|
# put nextcloud into maintenance, outside the home-rob container
|
|
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo sed -i \"s|'maintenance' => false|'maintenance' => true|g\" $SBZ_MOUNT_PATH$NEXTCLOUD_PATH/config/config.php"
|
|
|
|
# rsync download from sbz
|
|
rsync -arlh -e "ssh -p $PORT -i $KEY" $USER_AT_HOST:${SBZ_MOUNT_PATH}${SOURCE_PATH} ${DEST_PATH}
|
|
|
|
# turn off nextcloud maintenance, outside the home-rob container
|
|
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo sed -i \"s|'maintenance' => true|'maintenance' => false|g\" $SBZ_MOUNT_PATH$NEXTCLOUD_PATH/config/config.php"
|
|
|
|
# umount my container
|
|
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo umount $SBZ_MOUNT_PATH"
|
|
|
|
|
|
|