Automated Wordpress backup/test environment sudo-code review


I want to automate cloning my production WP to a testing WP install. I am good enough with Unix to get into trouble so I was hoping some guru’s can tell me if this sudo-code for a cron job is sane or not.

cp WP Production to WP Test on it’s own subdomain
sed replace database name
mysql overwrite tables on WP Test from WP Productions DB dump

Sound good?

-Zach Lym[hr]
Would it be better to just use the restore functionality built into DH?
Does the “Copy the backup files to /home/indolering/cpw3.dreamhosters.com_TIMESTAMP” option create another DB or would it overwrite the production database?


The database restore functionality in the DreamHost Panel only works for restoring from backups. It can’t be used to create an instant clone of a database — you’ll need to dump and restore a database yourself (using mysqldump) for that.

Also, keep in mind that a few paths end up getting baked into the WordPress database (mainly in the options table). Make sure those get changed appropriately.