Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.
Wordpress Backup Restore and Migrate Script

Wordpress Backup Restore and Migrate Script 3.0.0

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE
The script will now auto detect the FILES__PATH, JAIL_FILES_LOC, APPS_PATH in Wordpress installs. You can also backup and restore if the installation techniques and directories are different. No variables need to be set to run the script. You can add to the backup-config the MAX_NUM_BACKUPS to limit the number of back up files kept.
If your all your Wordpress installs are in a subdirectory of the pool path then the search will be quicker if you specify the FIND_DIR variable, but will work fine without it.
Minor feature: Although it is not recommended to place your Wordpress install in the root of the pool the script can now handle that scenario.

Autodetection of the APP_PATH won't work under that circumstance.

Set APPS_PATH="/" in the backup-config file, will tell it the use a blank APPS_PATH.



Bug fix: fixed autodetect of the APPS_PATH not working if your pool was not `/mnt/v1`.
Basil Hendroff's script now has a new variable to replace
Code:
FILES_PATH="$POOL_PATH/apps/wordpress/files"
DB_PATH="$POOL_PATH/apps/wordpress/db"

with
for a single site
Code:
WP_ROOT="/apps/wordpress"

for multiple sites
Code:
WP_ROOT="/apps/wordpress/site1"


My backup script will now automatically find the location of the wordpress install and set the APP_PATH variable for you.

In his scipt:
for a single site it will be apps
for mutiple sites it will be apps/wordpress

You can still set all the variables manually in the backup-config files to maintain compatibility with other installs. See README.md file and example #6 for more details.
Minor fix. The MAX_NUM_BACKUPS variable was not being set when the script was run from a cron job. An unlimited number of backups were saved even if you set MAX_NUM_BACKUPS to a number in the backup-config only when running the script from a cron job.
  • Better Error Checking
  • Remove variables that are not needed
  • Add Maintenance Mode to prevent writing to site while backing up or restoring
  • Get passwords with special characters from /root/<Jail_Name>_db_password.txt and wp-config-.php files
  • If Migration set in backup-config will automatically go to restore
Thanks to @Basil Hendroff for his maintenance mode suggestion.
Created better error correction in case the wordpress install or password file doesn't exist or the data directory is renamed.

Defaults to unlimited backups unless the MAX_NUM_BACKUPS variable is set in the backup-config file.
Fixed failure to create backup directory if it did not exist.
Can now backup and restore with the default Authentication Plugin in MariaDB 10.3 and below as well as MariaDB 10.4 and above.
Cleanup comments
Check if backup-config exists. Can still pass JAIL_NAME with arguments like ./backup.sh personal
Delete old backups uses <JAIL_NAME>_*.tar.gz to filter. "_" added
Added the option to pass the JAIL_NAME to the script from the command line instead of the backup-config.
This would look like ```./backup.sh personal```. You can still just set the JAIL_NAME from the backup-config.
Now you can manually backup a wordpress install, while still having a cron to backup all the installs. If an argument is passed for a restore, you will not be asked which install to restore from the script. You can only install one wordpress install at a time. Run the script again to do another restore.
Top