working rsync from sbz
This commit is contained in:
1 parent
c2c7932095
commit
13eae3f11a
4 files changed
+96
No files matched your search
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/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"
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user