WordPress blog unattended backup script to take backup along with files and database

My next wordpress project is to install good backup plug-in for WordPress. At last I made my own wordpress backup script . Thanks to spiralbound . I modified his script according to my needs. This is the best way to backup wordpress blog.

This freeware bash script for wordpress backup will tar and send data files and data base dump to remote ftp. Virtually you can backup any database based dynamic site with this backup script.

It uses ncfttput to send files to remote ftp. WordPress backup script works with any linux based shared hosting (as far as I know).

#!/bin/sh
Date=`date +“%Y-%m-%d-%H-%m-%M”`;
echo “Creating Database Backup”;
/usr/bin/mysqldump -u urdbusername  -pxxxx yourdbname | gzip > /home/anyfolder/wordpressdb-$Date.sql.gz;
echo “Done”;
echo “Creating Filesystem Backup”;
cd /home/yourwebfolder/;
/bin/tar -czf /home/anyfolder/wordpressdata-$Date.tgz  yourblogsubdirectory ;
echo “Done”;
echo “Backup Complete”;
cd /home/anyfolder
/usr/bin/ncftpput -u yourftpuserid  -p xxxx  -DD  ftp.yourftpserver.com /yourdestinationfolder    wordpressd*.*

Next put above script crontab so that it will run daily once.

MyFreeCopyright.com Registered & Protected

This entry was posted in Uncategorized, Wordpress, web, web-scripts and tagged , , , , , . Bookmark the permalink.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">