Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Tue May 17, 2011 3:01 pm 
Offline
Senior Newbie

Joined: Sat May 14, 2011 5:28 am
Posts: 14
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


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group