Bash scripts for backup/restore of Wordpress
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DecaTec f6e37fb32c Readme 1 year ago v1.0.2 1 year ago
LICENSE Initial commit 4 years ago Readme 1 year ago v1.0.2 1 year ago v1.0.2 1 year ago



This repository contains two bash scripts for backup/restore of Wordpress.

General information

For a complete backup of any Wordpress instance, you'll have to backup these items:

  • The Wordpress file directory (usually /var/www/wordpress)
  • The Wordpress database

The scripts take care of these items to backup automatically.


  • pigz ( when using backup compression. If not available, you can use another compression algorithm (e.g. gzip)

Important notes about using the scripts

  • After cloning or downloading the repository, you'll have to edit the scripts so that they represent your current Wordpress installation (directories, users, etc.). All values which need to be customized are marked with TODO in the script's comments.


  1. Clone the repository: git clone
  2. Set permissions:
    • chown -R root Wordpress-Backup-Restore
    • cd Wordpress-Backup-Restore
    • chmod 700 *.sh
  3. Modify the scripts and so that these fit to your Matrix Synapse instance (see TODO in the script's comments)
  4. Start using the scripts: See sections Backup and Restore below


In order to create a backup, simply call the script on your Wordpress machine. If this script is called without parameter, the backup is saved in a directory with the current time stamp in your main backup directory: As an example, this would be /media/hdd/wordpress_backup/20170910_132703. The backup script can also be called with a parameter specifiying the main backup directory, e.g. ./ /media/hdd/nwordpress_backup. In this case, the directory specified will be used as main backup directory.


For restore, just call This script expects at least one parameter specifying the name of the backup to be restored. In our example, this would be 20170910_132703 (the time stamp of the backup created before). The full command for a restore would be ./ 20170910_132703. You can also specify the main backup directory with a second parameter, e.g. ./ 20170910_132703 /media/hdd/wordpress_backup.