EDIT: Sorry just me having a blank moment, all fixed up now
So i currently have this script, and im looking to backup the tar'd dirs and ftp them to my home server. However when i run the script to file doesnt appear on my home server, but no errors or warnings appear, have run through the script manually line by line and all worked out. Im loggin into the ftp using automatic login with the .netrc file.
Code:
#!/bin/sh
BACKUPDIR=/tmp/backup/
FILE=backup-`date +%d-%m-%Y`.tar.gz
if [ -d $BACKUPDIR ];
then
cd $BACKUPDIR
if [ -f $FILE ];
then
rm $FILE
fi
tar -Pczf $FILE /var/www/ /var/mail/ /var/lib/mysql/ /home/
else
mkdir $BACKUPDIR
cd $BACKUPDIR
tar -Pczf $FILE /var/www/ /var/mail/ /var/lib/mysql/ /home/
fi
chmod 777 -R /tmp/backup/
HOST=dev.iwader.co.uk
FTPDIR=/home/wader/backups/vps/velocity/
FTPFILE=/tmp/backup/$FILE
ftp -i $HOST <<EOF
cd $FTPDIR
put $FTPFILE
quit
EOF
rm $FTPFILE
chmod 755 -R /tmp/backup/
exit 0