änderungen lokal auf bfds
This commit is contained in:
1 parent
6bcac443da
commit
2bfedea3f1
3 files changed
+17
-6
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh
|
||||||
|
nextcloud/config/config.php
|
||||||
@@ -10,13 +10,16 @@
|
|||||||
# -l, --links When symlinks are encountered, recreate the symlink on the destination.
|
# -l, --links When symlinks are encountered, recreate the symlink on the destination.
|
||||||
# -h, --human-readable Output numbers in a more human-readable format.
|
# -h, --human-readable Output numbers in a more human-readable format.
|
||||||
|
|
||||||
|
SCRIPTPATH=$(dirname `realpath $0`)
|
||||||
|
cd $SCRIPTPATH
|
||||||
|
|
||||||
# rsync source -> destination
|
# rsync source -> destination
|
||||||
SOURCE_PATH=/var/www/
|
SOURCE_PATH=/var/www/
|
||||||
DEST_PATH_FILES=/mnt/bfds/rob/backup/server/spaceboyz.net/var_www
|
DEST_PATH_FILES=/mnt/bfds/rob/backup/server/spaceboyz.net/var_www
|
||||||
|
|
||||||
# ssh credentials
|
# ssh credentials
|
||||||
PORT="42523"
|
PORT="42523"
|
||||||
KEY="./sbz_keyless"
|
KEY="${SCRIPTPATH}/sbz_keyless"
|
||||||
USER_AT_HOST="rob@spaceboyz.net"
|
USER_AT_HOST="rob@spaceboyz.net"
|
||||||
|
|
||||||
# path of the database backups
|
# path of the database backups
|
||||||
@@ -28,16 +31,20 @@ SBZ_MOUNT_PATH=/home/rob/tmp_mnt
|
|||||||
## path of the nextcloud instance (on SBZ)
|
## path of the nextcloud instance (on SBZ)
|
||||||
NEXTCLOUD_PATH=/var/www/html/nextcloud
|
NEXTCLOUD_PATH=/var/www/html/nextcloud
|
||||||
|
|
||||||
EXCLUDE="--exclude backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwss"
|
EXCLUDE="--exclude-from exclude-list"
|
||||||
|
|
||||||
|
|
||||||
# mount my lxc container into my home on sbz
|
# 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"
|
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/html/nextcloud/data"
|
||||||
|
|
||||||
# put nextcloud into maintenance, outside the home-rob container
|
# 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"
|
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 download from sbz
|
||||||
rsync -arlh --progress $EXCLUDE -e "ssh -p $PORT -i $KEY" $USER_AT_HOST:${SBZ_MOUNT_PATH}${SOURCE_PATH} ${DEST_PATH_FILES}
|
rsync -az --progress $EXCLUDE -e "ssh -p $PORT -i $KEY" $USER_AT_HOST:${SBZ_MOUNT_PATH}${SOURCE_PATH} ${DEST_PATH_FILES}
|
||||||
|
|
||||||
# turn off nextcloud maintenance, outside the home-rob container
|
# 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"
|
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"
|
||||||
@@ -50,12 +57,14 @@ ssh -p $PORT -i $KEY $USER_AT_HOST "sudo umount $SBZ_MOUNT_PATH"
|
|||||||
|
|
||||||
cd $DEST_PATH_DB
|
cd $DEST_PATH_DB
|
||||||
# kick off DB dumping
|
# kick off DB dumping
|
||||||
curl https://rob.spaceboyz.net/backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh/dump_all_databases.php
|
curl --insecure https://rob.spaceboyz.net/backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh/dump_all_databases.php
|
||||||
# download DB dumps
|
# download DB dumps
|
||||||
wget https://rob.spaceboyz.net/backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh/dumps.zip
|
wget --no-check-certificate https://rob.spaceboyz.net/backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh/dumps.zip
|
||||||
if [ -f dumps.zip ]
|
if [ -f dumps.zip ]
|
||||||
then
|
then
|
||||||
mv dumps.zip all_databases_dump.zip
|
today=`date +%F`
|
||||||
|
mv dumps.zip all_databases_dump_$today.zip
|
||||||
else
|
else
|
||||||
echo "Datenbank Dump konnte nicht herunter geladen werden"
|
echo "Datenbank Dump konnte nicht herunter geladen werden"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
Regular → Executable
File mode changed.
Reference in new issue
Block a user