A bash script for synchronizing wordpress over ssh
Use with caution and at your own risk.
Do not add the configuration file to version control!
chmod +x /path/to/wpsync/wpsync
ln -s /path/to/wpsync/wpsync /usr/local/bin/wpsync
Copy the configuration file config-sample to a folder called .wpsync and rename it to config
Edit it in your favorite text editor.
The script assumes that you already have ssh access to the remote server through using your ssh keys.
wpsync push_db
wpsync pull_db
wpsync push_files
wpsync pull_files
wpsync push_plugins
wpsync pull_plugins
- add some colors
- search and replace whole database
- move config file to a .wpsync folder where also the backup files will be stored
- add datetime to backup files
- add some new features:
- replace database charset if
l_db_charsetandr_db_charsetare provided. This is because wordpress changed their default database charset toutf8mb4instead ofutf8. - new commands:
push_pluginsandpull_pluginsvia rsync
- replace database charset if
- fix a small bug (functions were being executed even if they were not defined as allowed commands)
- make
l_upload_dirandr_upload_diroptional. if they are not defined in the config file the standardwp-content/uploadswill be used.