I run several websites / blogs powered off wordpress. In order to back them up I’ve written a unix shell script to do this. It will automatically read the database settings and do a dump of it, as well as copy themes / plugins / uploads.
There are two versions. One will copy files locally, the other allows a remote sync to another server which is compatible with Dreamhost.
The local copy version can be found here: wp-backup.sh Example usage can be seen below. The -t option allows you only to backup a single theme. The -u option allows you to skip backing up uploads.
./wp-backup.sh /path/to/wordpress /path/to/backup
./wp-backup.sh -t theme -u /path/to/wordpress /path/to/backup
There is also a version to work with Dreamhost’s free (with hosting) 50GB backup plan than can be downloaded here: wp-remote.sh
./wp-remote.sh /path/to/wordpress [email protected]:backup
where b123456 is your backup user
1) Your wp-config file must be pretty strict in order to be read:
define(‘DB_NAME’, ‘database’); // The name of the database
define(‘DB_USER’, ‘username’); // Your MySQL username
define(‘DB_PASSWORD’, ‘password’); // …and password
2) The directory you’re copying to must already exist.
3) The options/order of the parameters in calling the script is very strict