Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ -f ~/.ssh/id.rsa ]; then
- echo "
- _|_|_| _|_| _|_|_| _| _| _| _| _|_|_|
- _| _| _| _| _| _| _| _| _| _| _|
- _|_|_| _|_|_|_| _|_| _|_|_|_| _| _| _|_|_|
- _| _| _| _| _| _| _| _| _| _|
- _|_|_| _| _| _|_|_| _| _| _|_| _|
- by k3rn3l0l
- Vesta2'@panel_name' migration script
- This script upload all sites backups to remote server
- "
- read -p 'Enter backup server username' us3r
- read -p 'Enter backup server IP' ip4ddr
- dirct='/home/admin/web'
- sitelist=$(ls "$dirct")
- for word in $sitelist
- do
- sitepath="$dirct"/"$word"/public_html
- mysqldump -u $(grep DB_USER $sitepath/wp-config.php | cut -d "'" -f 4) -p$(grep DB_PASSWORD "$sitepath"/wp-config.php | cut -d "'" -f 4) $(grep DB_NAME "$sitepath"/wp-config.php | cut -d "'" -f 4) > "$sitepath"/"$word".sql
- tar czvf "$dirct"/"$word" "$word".tar.gz
- scp "$word".tar.gz "$us3r"@"$ip4ddr":~/
- done
- else
- echo "This script make all sites backups and upload archives to remote server, but installed ssh-key is required."
- echo "For install this key, enter this commands:"
- echo "ssh-keygen"
- echo "ssh-copy-id <user>@<ipaddress>"
- exit 1
- fi
Add Comment
Please, Sign In to add comment