How to Take FTP Backup for WordPress Database
If you want to take backups of WordPress blog’s database and files then this script is the best choice to backup your blog onto a remote FTP server. Basically, it is an update version of WordPress Backup to FTP. Now you have better support for caching plug-ins. Besides that, this script also enables auto-detecting database settings. The latest version is quite simple and easy to use. It enables you to backup a number of WordPress blogs to the same FTP server. You need to do a short initial configuration, but it is extremely user friendly.
Instructions
-
1
Save it first
Before you execute the script make sure you save it. -
2
Edit it
It is assumed that you saved it with a name wp-backup. Once you are done with it, use your preferred editor to edit the file. Then set the 5 configuration variable according to your requirement. -
3
Folder for local backups
You can save the local backups on the folder known as BACKUP-DIR. FTP host, username and password is controlled by FTP_HOST, FTP_USER and FTP_PASS for the remote backup server. The folder of FTP server is all set by FTP_BACKUP_DIR in order to save the remote backup accordingly. -
4
After initial configuration
Once you are done with the initial configuration, make sure to execute the script. After that give the path to the blog as an argument such as;
./wp-backup /home/someuser/myblog -
5
Final Script
Now you are done with the whole process. The script given below will allow you to backup many WordPress blogs to the same FTP server.
#!/bin/bash
# Copyright 2008, 2010 Guy Rutenberg
# WordPress FTP backup 2.0
# Easily backup wordpress instances via ftp.
#
# Change Log:
# ===========<
# 2.0:
# - Auto-detect database settings.
# - Exclude cache data from backups.
BACKUP_DIR=
FTP_HOST=
FTP_USER=
FTP_PASS=
FTP_BACKUP_DIR=<
# end of configuration - you probably don't need to touch anything bellow
PROG=`basename "$0"`
print_usage () {
echo "USAGE: ${PROG} [options] BLOG_ROOT"
echo "Backup a WordPress blog"
}
print_help () {
print_usage
cat << EOF Options: -h, --help show this help message and exit EOF } TEMP=`getopt -o h --long help -n "$PROG" -- "$@"` f (($?)); then >print_usage
exit 1
fi
eval set -- "$TEMP"
while true ; do
case "$1" in
-h|--help) print_help; exit ;;
--) shift; break;;
esac
done
if [ -z "$1" ]
then
print_usage > /dev/stderr
fi
BLOG_DIR=$1
DB_NAME=`echo "