Created
March 5, 2024 18:11
-
-
Save bicisteadm/0b5fc270918859532d1ccb2152c5bdb4 to your computer and use it in GitHub Desktop.
ISPconfig migrate
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/sh | |
| while getopts s:d: flag | |
| do | |
| case "${flag}" in | |
| s) sourceDatabase=${OPTARG};; | |
| d) destinationDatabase=${OPTARG};; | |
| esac | |
| done | |
| sourceUser="root" | |
| sourcePassword="password" | |
| sourceHostname="localhost" | |
| sourcePort="3306" | |
| destinationUser="root" | |
| destinationPassword="password" | |
| destinationHostname="172.16.1.21" | |
| destinationPort="3306" | |
| echo "Exporting $sourceDatabase database to ./mysqldump.sql" | |
| start_export=`date +%s` | |
| mysqldump -u $sourceUser -p$sourcePassword --opt $sourceDatabase > mysqldump.sql | |
| # Done creating a dump of mysqldump.sqlls | |
| end_export=`date +%s` | |
| echo "Database exported in" $((end_export-start_export)) "seconds" | |
| echo "Importing Database to... " | |
| start_import=`date +%s` | |
| mysql -u $destinationUser -p$destinationPassword -h $destinationHostname -P $destinationPort $destinationDatabase < ./mysqldump.sql | |
| # Done importing the dump to managed db | |
| end_import=`date +%s` | |
| echo "Database imported in" $((end_import-start_import)) "seconds" | |
| echo "Total runtime: " $((end_export-start_export+end_import-start_import)) "seconds" |
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/sh | |
| while getopts s:h:u:p: flag | |
| do | |
| case "${flag}" in | |
| s) sourceFolder=${OPTARG};; | |
| h) host=${OPTARG};; | |
| u) username=${OPTARG};; | |
| p) password=${OPTARG};; | |
| esac | |
| done | |
| cd $sourceFolder | |
| lftp ftp://$username:$password@$host/web | |
| rm -r . | |
| mirror -R . |
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/sh | |
| while getopts h:p: flag | |
| do | |
| case "${flag}" in | |
| h) sshhost=${OPTARG};; | |
| p) sshpassword=${OPTARG};; | |
| esac | |
| done | |
| doveadm user *@* | while read user; do | |
| doveadm -Dv sync -u $user sshpass -p $sshpassword ssh $sshhost doveadm dsync-server -u $user | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment