Local backup of wordpress files and mysql db, using tar and mysqldump

Wrote a quick script to make a copy of files + db

#!/bin/bash

cd /srv/www/wordpress
tar -zcvf ~/backup-$(date +"%Y%m%d").tar.gz *
cd
ls backup-*
sudo mysqldump -u root --password="<insert password>" wordpress > ./mysql-$(date +"%Y%m%d").backup
ls mysql-*

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.