Blog by Daniel Hauck. Sysadmin, Developer, Blogger.

TAG: mysql

Simple WordPress Bash Backup Script

Hey Guys,

I needed to do some backups of multiple wordpress sites, so I decided to write a backup script especially for wordpress.

All you need is to call the script with two parametes, the first is the folder where your wordpress instance is installed, in my case /var/www/
The second is the folder where to backup it.

So for example:
./backup_wordpress /var/www/ /tmp/backup/

That’s all, the script figures out how to connect to the database, creates a gzipped dump with timestamp, and creates a tar archive also with a timestamp.

You’ll find it in your specified folder under wp and db.

That’s it, have fun.

Quick and dirty MySQL Backup

When you just need a simple backup of all your databases, this three lines do the job for you.

Just save it to a file and run it as a cron every night
00 01 * * * /srv/scripts/mysql_backup
and you get a zipped dump of every database with a timestamp.

It is easy extendable, if you want to exclude a database just write it into the grep regex
grep -Ev "(information_schema|performance_schema|another_database)"

Have fun! 🙂

There are no more results.