This script automatize almost migration process from one server to another, you can migrate Files
, MySQL
or both at same time (currently only one folder + database per execution).
You can batch this with another batch file to automatize the full translation.
IMPORTANT: This script is not Backup oriented, but it can be used to local backup (currently no support resotoration after-backup).
- Bash
- scp (client and server)
- ssh (client and server)
Download this script and execute:
chmod +x migrate.sh
# Optionally (to execute from any folder)
ln migrate.sh /bin
./migrate.sh -h
./migrate.sh \
--local-folder-temp ~/temp_migration/ \
--local-folder-migrate /var/www/domain/web \
--local-backup-remove true \
--remote-backup-remove true \
--remote-folder-clean false \
--remote-folder-migrate /var/www/domain/web \
--remote-ssh-user-server user@remoteserver \
--remote-ssh-port 22 \
-i ~/.ssh/id_rsa \
--local-db-user DBUSER \
--local-db-password PWD \
--local-db-name DBNAME \
--remote-db-user DBUSER \
--remote-db-password PWD \
--remote-db-name DBNAME
If you need to modify SQL file (paths or something) "on the fly", you can modify the script OR check PHP - Web and MySQL fast migration
For ispconfig
backups check: https://github.com/ProtocolNebula/simple-ispconfig-backup