move all existing in subfolders
This commit is contained in:
1 parent
cc069f63ef
commit
6491336e60
48 files changed
No files matched your search
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#!/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.
|
||||
|
||||
SCRIPTPATH=$(dirname `realpath $0`)
|
||||
cd $SCRIPTPATH
|
||||
|
||||
# rsync source -> destination
|
||||
SOURCE_PATH=/var/www/
|
||||
DEST_PATH_FILES=/mnt/bfds/rob/backup/server/spaceboyz.net/var_www
|
||||
|
||||
# ssh credentials
|
||||
PORT="42523"
|
||||
KEY="${SCRIPTPATH}/sbz_keyless"
|
||||
USER_AT_HOST="rob@spaceboyz.net"
|
||||
|
||||
# path of the database backups
|
||||
DEST_PATH_DB=/mnt/bfds/rob/backup/server/spaceboyz.net/mariadb
|
||||
|
||||
## path where home-rob container is mouted into host (on SBZ)
|
||||
SBZ_MOUNT_PATH=/home/rob/tmp_mnt
|
||||
|
||||
## path of the nextcloud instance (on SBZ)
|
||||
NEXTCLOUD_PATH=/var/www/html/nextcloud
|
||||
|
||||
EXCLUDE="--exclude-from exclude-list"
|
||||
|
||||
|
||||
# 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"
|
||||
|
||||
# grand read permissons if not given
|
||||
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo chmod -R +rx ${SBZ_MOUNT_PATH}/var/www/nextcloud-data"
|
||||
|
||||
# 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 --quiet -a -zz --progress $EXCLUDE -e "ssh -p $PORT -i $KEY" $USER_AT_HOST:${SBZ_MOUNT_PATH}${SOURCE_PATH} ${DEST_PATH_FILES}
|
||||
|
||||
# turn off nextcloud maintenancThis rsync lacks old-style --compress due to its external zlibe, 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"
|
||||
|
||||
|
||||
### Get all databases
|
||||
|
||||
cd $DEST_PATH_DB
|
||||
# kick off DB dumping
|
||||
curl --insecure --silent https://rob.spaceboyz.net/backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh/dump_all_databases.php
|
||||
# download DB dumps
|
||||
curl --insecure --silent https://rob.spaceboyz.net/backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh/dumps.zip > dumps.zip
|
||||
if [ -f dumps.zip ]
|
||||
then
|
||||
today=`date +%F`
|
||||
mv dumps.zip all_databases_dump_$today.zip
|
||||
else
|
||||
echo "Datenbank Dump konnte nicht herunter geladen werden"
|
||||
fi
|
||||
Reference in new issue
Block a user