-
-
Save yashodhank/db68668faa1414ac38eaf0cba35502a1 to your computer and use it in GitHub Desktop.
Plesk to cPanel migration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Plesk to cPanel | |
echo "" | |
echo "Plesk To Cpanel Migration Script \n=======================================\n" | |
echo "Make sure that the cPanel user has shell access enabled and an sshe key is setup for the same. \nAdd the private key in the location where the script is executing with name key\n=================================================================================================\n" | |
echo "Before executing this script, create three files in the directory where your are executing the script \nThe file names should be 'dblist', 'emaillist', 'sdomainlist' dblist \nshould contain the name of all dbs, emaillist should contain all the email account without @ and domain name, \nsdomain list should contain the subdomain name individual names should be written in sperate lines\n=====================================================================\n\n" | |
echo "Enter the domain domain name in the source server:" | |
read d; | |
echo "Enter the domain domain name in the destination server:" | |
read d2; | |
echo "Enter the username in the destination server:" | |
read u; | |
echo "Enter the destination server IP address:" | |
read s; | |
#DB | |
for j in `cat dblist`; do | |
mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` $j > /var/www/vhosts/$d/$j.sql; | |
scp -r -i key -P 1022 /var/www/vhosts/$d/$j.sql $u@$s:/home/$u/public_html/; | |
done | |
#Emails | |
for i in `cat emaillist`; do | |
scp -r -i key -P 1022 /var/qmail/mailnames/$d/$i/Maildir/cur/* $u@$s:/home/$u/mail/$d2/$i/cur/; | |
scp -r -i key -P 1022 /var/qmail/mailnames/$d/$i/Maildir/new/* $u@$s:/home/$u/mail/$d2/$i/new/; | |
scp -r -i key -P 1022 /var/qmail/mailnames/$d/$i/Maildir/.Sent\ Messages/* $u@$s:/home/$u/mail/$d2/$i/.Sent/; | |
done | |
scp -r -i key -P 1022 /var/www/vhosts/$d/httpdocs/* $u@$s:/home/$u/public_html/ | |
#subdomains | |
for k in `cat sdomainlist`; do | |
scp -r -i key -P 1022 /var/www/vhosts/$d/subdomains/$k/httpdocs/* $u@$s:/home/$u/public_html/$k; | |
done | |
Echo "Migration complete\n" | |
Echo "You have to go to the destination server and restore the database using the database dump files licated in /home/$u/public_html" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment