Neue Datei hochladen
This commit is contained in:
parent
6405bf424d
commit
e17893ae70
33
backup-side.sh
Normal file
33
backup-side.sh
Normal file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# this script is supposed to run as cronjob on the backup side
|
||||
|
||||
# Set bandwidthlimit; 1st parameter
|
||||
if [ -n "$1" ];then
|
||||
bw=$1
|
||||
else
|
||||
bw=100000
|
||||
fi
|
||||
|
||||
# copy DB
|
||||
/usr/bin/rsync --bwlimit=$bw -ae 'ssh -p 64222 -i /home/nc-cloner/.ssh/id_rsa -o PreferredAuthentications=publickey' user@example.com:/home/nc-cloner/nc-bak /home/username/
|
||||
|
||||
# Copy Files
|
||||
/usr/bin/rsync --bwlimit=$bw -ae 'ssh -p 64222 -i /home/nc-cloner/.ssh/id_rsa -o PreferredAuthentications=publickey' username@example.com:/home/username/ncp_data /home/username/
|
||||
|
||||
# Vars
|
||||
host=localhost
|
||||
user=xxxxxxxxxxxxxxxxx
|
||||
pass="xxxxxxxxxxxxxxxx"
|
||||
db=nextcloud
|
||||
|
||||
cd /home/username/nc-bak
|
||||
|
||||
DBFILE=nc-db.sql.gz
|
||||
if test -f "$DBFILE"; then
|
||||
/bin/gunzip nc-db.sql.gz
|
||||
|
||||
# overwrite NC DB with copy from production
|
||||
/usr/bin/mysql -h$host -u$user -p$pass $db < nc-db.sql
|
||||
|
||||
rm nc-db.sql*
|
||||
fi
|
Loading…
Reference in New Issue
Block a user