Warning: Attempt to read property "display_name" on bool in /var/www/html/wp-content/plugins/wordpress-seo/src/generators/schema/article.php on line 52
A Basic Database and Content Backup Script - Aaron Jorbin

Polyhistoric Man Of The Web

A Basic Database and Content Backup Script

I presented an unconference session at the great WordCamp Portland and have cleaned up my backup script for WordPress (and really any db/single uploading/plugin/theme folder program). Comment here if you have any questions about how it works or suggestions for how to improve it. Like WordPress, it’s available under the GPL v2

#! /bin/sh

# config
# end config

DATE=`date +%Y.%m.%d.%k.%m | tr " " _`
echo Licensed under the GPL version 2 http://www.gnu.org/licenses/gpl-2.0.html
echo Copyright 2009 Aaron Jorbin https://aaron.jorb.in
echo $DATE start backup with mysqldump
mysqldump $DBTABLE --add-drop-table -h localhost -u $DBUSER --password=$DBPASSWORD --single-transaction > db.$DATE
echo mysqldump done, gziping it
tar cfz db.$DATE.tar.gz db.$DATE
rm db.$DATE
echo Database backup gzipped, Tarring up our WordPress folder
tar cfz mu.$DATE.tar.gz -C / $CONTENTPATH
echo copying files to backup folder
mv db.$DATE.tar.gz $DESTINATION/
mv mu.$DATE.tar.gz $DESTINATION/
echo Cleaning Up
#clean up files that are sitting there
find $DESTINATION -type f -mtime +14 -exec rm {} ;
echo Thank you for backing up WordPress.
echo ---
echo The Poetic Code
echo Options, Comments, Posts and more
echo Safer then before

If you have a reaction, you should get a blog and send me a webmention or pingback.