Updated WP-CLI backup script

Here’s a new version of the wp-cli backup script mentioned previously. This adds a check that it’s running as a user, and backs up the upload directory too.

You need to have wp-cli installed and run this in your WordPress root, as a regular (non-root) user.

If you use this I’d love to hear from you in the comments.

2 Responses

  1. Fred
    Fred at |


    Thank you for sharing the script…
    Just a few things,
    1. Why do you check if the backups directory is writable twice (WPBKUPS and WPBKUPSROOT) what is the difference between the 2?

    2.When I run the script I get the following error

    + ‘[[‘ -eq 0 ]]
    ./wpcli_db_backup.sh: [[: not found
    + WPBKUPS=/usr/local/www/production/wpbackup
    + [ -d /usr/local/www/production/wpbackup ]
    + [ -w /usr/local/www/production/wpbackup ]
    + echo ‘Backups directory /usr/local/www/production/wpbackup is writable; proceeding.\n’
    Backups directory /usr/local/www/production/wpbackup is writable; proceeding.\n
    + BKUPLOG=/usr/local/www/production/wpbackup/quickbackupwp.log
    + exec
    $WPBKUPS is /usr/local/www/production/wpbackup\n

    Could you please assist?

    Thank you

Comments are closed.