Search This Blog

Backup your web site using wget (ftp)

wget --output-file=wget.log  --tries=2  --mirror  --ftp-user=YourUserName  --ftp-password=YourPassword   ftp://168.site90.net


Here is a wrapper script:
#!/bin/bash
usage() {
        echo ""
        echo "`basename $0` -u <ftp_user> -p <ftp_password> <ftp_address>"
        echo ""
}

for FTP_SITE; do true; done
until [[ -z $1 ]]
do
        case "$1" in
                "--user" | "-u" )
                FTP_USER=$2
                shift
                shift
                ;;
                "--password" | "-p" )
                FTP_PASSWORD=$2
                shift
                shift
                ;;
                * )
                shift
                ;;
        esac
done

if [[ -z $FTP_SITE ]]; then
        echo "ERROR: invalid arguments. No ftp address specified."
        usage
        exit 1
fi


if [[ -z $FTP_USER ]]; then
        echo "ERROR: invalid arguments. No ftp user specified."
        usage
        exit 1
fi

if [[ -z $FTP_PASSWORD ]]; then
        echo "ERROR: invalid arguments. No ftp password specified."
        usage
        exit 1
fi

if [[ -z "`which wget`" ]]; then
        echo "ERROR: wget not found."
        usage
        exit 1
fi

wget --output-file=wget.log  --tries=2  --mirror  --ftp-user=$FTP_USER  --ftp-password=$FTP_PASSWORD   $FTP_SITE

No comments:

Post a Comment