To start ispconfig migration,
just create script file, and paste this code.
vi ispconfig-migration.sh
then change its mood for execution,
chmod +x ispconfig-migration.sh
and run it (to start migration)
./ ispconfig-migration.sh
#! / Bin / bash
#
echo "# ########################################################## # "
echo "## Welcome to My Blog##"
echo "## attaakwal.blogspot.com ##"
echo "## ##"
echo "# ########################################################## # "
echo ""
echo "Please enter the server address of your master server first:"
read main_server
#common_args = '- aPv --delete'
#common_args = '- aPv --dry-run'
common_args = '- APV'
install_rsync = "apt-get -y install rsync"
www_start = "service apache2 start"
www_stop = "service apache2 stop"
db_start = "service mysql start"
db_stop = "service mysql stop"
main_server= "attaakwal.blogspot.com"
function menu {
clear
echo "# ########################################################## # "
echo " "
echo "## 1. Installation of rsync on the remote server ##"
echo "## 2. MySql start synchronization ##"
echo "## 3. start web directory synchronization ##"
echo "## 4. start email synchronization ##"
echo "## 5. passwords and user accounts start synchronization ##"
echo "## 6. Start MailMan synchronization ##"
echo "## 7. end program ##"
echo "# ########################################################## # "
read -n 1 input
}
function install {
clear
echo "Install Rsync on the remote server ..."
ssh $ main_server "$ install_rsync"
echo "ending"
Menu
}
function db_migration {
clear
echo "# ########################################################## # "
echo " "
echo " Start MySql Migration "
echo " Step1: "
echo " Create backup on remote server "
echo " "
echo " Step2: #############"
echo " MySql database copy #############"
echo "# ########################################################## # "
echo " Step3: "
echo " MySql import data record "
echo "# ########################################################## # "
echo ""
echo "Create database backup ............................................. ................... "
echo "Please enter the MySql password for the user ROOT on the server $ main_server:"
read mysqlext
ssh $ main_server "mysqldump -u root -p $ mysqlext --all-databases> fulldump.sql"
clear
echo "Copy the backup ............................................. ........................ "
rsync $ common_args $ main_server: / root / mysql / / root / mysql /
clear
echo "Import backup .............................................. .......................... "
echo "Please enter the MySql password for the user ROOT: ............................."
read mysql2
mysql -u root -p $ mysql2 </root/mysql/fulldump.sql
clear
echo "Perform MySql Check ............................................ ...................... "
mysqlcheck -p -A --auto-repair
echo "# ########################################################## # "
Menu
}
function www_migration {
clear
echo "# ########################################################## # "
echo "################## start web migartion ######################"
echo " "
echo "1. stopping the web server "
echo " "
echo "################## Migartion Start ##################"
echo " "
$ www_stop
rsync $ common_args --compress --delete $ main_server: / var / www / / var / www
rsync $ common_args --compress --delete $ main_server: / var / log / ispconfig / httpd / / var / log / ispconfig / httpd
$ www_start
echo "# ########################################################## # "
Menu
}
function mail_migration {
clear
echo "---- Starting Mail migration ..."
echo "# ########################################################## # "
echo " "
echo "################## Start Mail Migartion ##################"
echo " "
echo "1. Migration vmail "
echo "# ########################################################## # "
echo " "
echo "################## Migartion vmail Logs ##################"
echo "# # "
rsync $ common_args --compress --delete $ main_server: / var / vmail / / var / vmail
rsync $ common_args --compress --delete $ main_server: /var/log/mail.* / var / log /
echo "################################################ ############ "
echo "################################################ ############ "
Menu
}
function files_migration {
clear
echo "# ########################################################## # "
echo " "
echo "############# start users and groups migration #######"
echo " "
echo "1. copy backup #######"
echo "################################################ ############ "
echo " "
echo "2. copy passwd into / root / old-server #######"
echo "################################################ ############ "
echo " "
echo "3. copy group to / root / old-server #######"
echo "# ########################################################## # "
rsync $ common_args $ main_server: / var / backup / / var / backup
rsync $ common_args $ main_server: / etc / passwd / root / old-server /
rsync $ common_args $ main_server: / etc / group / root / old-server /
echo " "
echo "# ########################################################## # "
Menu
}
function mailman_migration {
clear
echo "# ########################################################## # "
echo " "
echo "############ start Mailman migration #############"
echo "# ########################################################## # "
rsync $ common_args --compress --delete $ main_server: / var / lib / mailman / lists / var / lib / mailman
rsync $ common_args --compress --delete $ main_server: / var / lib / mailman / data / var / lib / mailman
rsync $ common_args --compress --delete $ main_server: / var / lib / mailman / archives / var / lib / mailman
cd / var / lib / mailman / bin && ./genaliases
echo " "
echo "################################################ ############ "
Menu
}
exit function {
clear
exit
}
Menu
while [$ input! = "0"]
do
case $ input in
0) exit
;;
1) install
;;
2) db_migration
;;
3) www_migration
;;
4) mail_migration
;;
5) files_migration
;;
6) mailman_migration
;;
esac
done
just create script file, and paste this code.
vi ispconfig-migration.sh
then change its mood for execution,
chmod +x ispconfig-migration.sh
and run it (to start migration)
./ ispconfig-migration.sh
#! / Bin / bash
#
echo "# ########################################################## # "
echo "## Welcome to My Blog##"
echo "## attaakwal.blogspot.com ##"
echo "## ##"
echo "# ########################################################## # "
echo ""
echo "Please enter the server address of your master server first:"
read main_server
#common_args = '- aPv --delete'
#common_args = '- aPv --dry-run'
common_args = '- APV'
install_rsync = "apt-get -y install rsync"
www_start = "service apache2 start"
www_stop = "service apache2 stop"
db_start = "service mysql start"
db_stop = "service mysql stop"
main_server= "attaakwal.blogspot.com"
function menu {
clear
echo "# ########################################################## # "
echo " "
echo "## 1. Installation of rsync on the remote server ##"
echo "## 2. MySql start synchronization ##"
echo "## 3. start web directory synchronization ##"
echo "## 4. start email synchronization ##"
echo "## 5. passwords and user accounts start synchronization ##"
echo "## 6. Start MailMan synchronization ##"
echo "## 7. end program ##"
echo "# ########################################################## # "
read -n 1 input
}
function install {
clear
echo "Install Rsync on the remote server ..."
ssh $ main_server "$ install_rsync"
echo "ending"
Menu
}
function db_migration {
clear
echo "# ########################################################## # "
echo " "
echo " Start MySql Migration "
echo " Step1: "
echo " Create backup on remote server "
echo " "
echo " Step2: #############"
echo " MySql database copy #############"
echo "# ########################################################## # "
echo " Step3: "
echo " MySql import data record "
echo "# ########################################################## # "
echo ""
echo "Create database backup ............................................. ................... "
echo "Please enter the MySql password for the user ROOT on the server $ main_server:"
read mysqlext
ssh $ main_server "mysqldump -u root -p $ mysqlext --all-databases> fulldump.sql"
clear
echo "Copy the backup ............................................. ........................ "
rsync $ common_args $ main_server: / root / mysql / / root / mysql /
clear
echo "Import backup .............................................. .......................... "
echo "Please enter the MySql password for the user ROOT: ............................."
read mysql2
mysql -u root -p $ mysql2 </root/mysql/fulldump.sql
clear
echo "Perform MySql Check ............................................ ...................... "
mysqlcheck -p -A --auto-repair
echo "# ########################################################## # "
Menu
}
function www_migration {
clear
echo "# ########################################################## # "
echo "################## start web migartion ######################"
echo " "
echo "1. stopping the web server "
echo " "
echo "################## Migartion Start ##################"
echo " "
$ www_stop
rsync $ common_args --compress --delete $ main_server: / var / www / / var / www
rsync $ common_args --compress --delete $ main_server: / var / log / ispconfig / httpd / / var / log / ispconfig / httpd
$ www_start
echo "# ########################################################## # "
Menu
}
function mail_migration {
clear
echo "---- Starting Mail migration ..."
echo "# ########################################################## # "
echo " "
echo "################## Start Mail Migartion ##################"
echo " "
echo "1. Migration vmail "
echo "# ########################################################## # "
echo " "
echo "################## Migartion vmail Logs ##################"
echo "# # "
rsync $ common_args --compress --delete $ main_server: / var / vmail / / var / vmail
rsync $ common_args --compress --delete $ main_server: /var/log/mail.* / var / log /
echo "################################################ ############ "
echo "################################################ ############ "
Menu
}
function files_migration {
clear
echo "# ########################################################## # "
echo " "
echo "############# start users and groups migration #######"
echo " "
echo "1. copy backup #######"
echo "################################################ ############ "
echo " "
echo "2. copy passwd into / root / old-server #######"
echo "################################################ ############ "
echo " "
echo "3. copy group to / root / old-server #######"
echo "# ########################################################## # "
rsync $ common_args $ main_server: / var / backup / / var / backup
rsync $ common_args $ main_server: / etc / passwd / root / old-server /
rsync $ common_args $ main_server: / etc / group / root / old-server /
echo " "
echo "# ########################################################## # "
Menu
}
function mailman_migration {
clear
echo "# ########################################################## # "
echo " "
echo "############ start Mailman migration #############"
echo "# ########################################################## # "
rsync $ common_args --compress --delete $ main_server: / var / lib / mailman / lists / var / lib / mailman
rsync $ common_args --compress --delete $ main_server: / var / lib / mailman / data / var / lib / mailman
rsync $ common_args --compress --delete $ main_server: / var / lib / mailman / archives / var / lib / mailman
cd / var / lib / mailman / bin && ./genaliases
echo " "
echo "################################################ ############ "
Menu
}
exit function {
clear
exit
}
Menu
while [$ input! = "0"]
do
case $ input in
0) exit
;;
1) install
;;
2) db_migration
;;
3) www_migration
;;
4) mail_migration
;;
5) files_migration
;;
6) mailman_migration
;;
esac
done
0 comments:
Post a Comment