My Simple FTP script

#!/bin/bash
cd /home/backup/server
if [ -e data ]
then
cd /home/backup/server/data/
HOST=’ftp-server-address’
USER=’username’
PASSWD=’password’
ncftp -u $USER -p $PASSWD $HOST << EOT
binary
cd /Volume_1
mkdir `date “+%d-%m-%y”`
cd `date “+%d-%m-%y”`
mput *
bye
EOT
fi
cd /home/backup/server
rm -rf data

with some help of Matthijs en of course myself and a little ‘maggi’ I created a bin/bash shell script to backup data (backup of the server) to one of my other FTP server(s)

it checks if the data folder is available and if so than the a ftp session is started, logged on, a folder with the todays date is made and the data is put in that folder. After that the data folder including the content will be removed. Yes I know there is no validation if A = B but I’ve no idea how to accomplish that, but this works in my test environment. This script is saving me about 4 Hours of datatransfer where FTP is showing me a niceĀ 10MB/s where Samba / NFS is showing me a not satisfied performance at all .. (I believe the total amount of data is about 40GB I have to backup everytime … ) ..

hints and tips welcome to have a A=B comparison before removal of the data folder ;-)