PDA

View Full Version : backup to ftp script



gkiper
2006-04-30, 07:10
Hi ,

i need a script that will backup the system and upload the backup file to ftp
server the script should have a schedule ability and fully automatic

kva.kva
2006-05-02, 02:12
for example

DATE=`/bin/date +%Y%m%d`
UNAME='CP_server'
PTH='/var/CPbackup/backups/'
FILE=$UNAME'_backup_'$DATE
#
/bin/backup --file $FILE 1>/tmp/backup.log 2>&1 <<EOC
yes
EOC
#
/bin/echo "The MD5 checksum of the $FILE.tgz is: `/usr/bin/md5sum $PTH$FILE'.tgz' | /bin/awk '{print $1}'`." > /tmp/$FILE'_md5.txt'
#
/usr/bin/ftp -in ip_ftp_server <<EOC
user username password
binary
passive
put $PTH$FILE'.tgz' $FILE'.tgz'
put /tmp/$FILE'_md5.txt' $FILE'_md5.txt'
close
bye
EOC
#