We run backup script to update backup file every hour.
I want to create a script, which transfer these files in another server using ftp as new backup file created every hour. Files should be stored with a unique name for every hour(e.g 20130708_13:00 , 20130708_14:00 and so on) and after completion of 12 hours these files should be deleted.
Please let me know how can I create script for that.
It would be very thankful l if anybody help me on this.
#tar the files into one file
FILE=backup_`date +%Y%m%d_%H%M`.tar.gz
tar cvf - FOLDER|gzip > $FILE
#ftp the file to another server
HOST='ftp.users.qwest.net'
USER='yourid'
PASSWD='yourpw'
ftp $HOST <<END_SCRIPT
user $USER
$PASSWD
put $FILE
quit
END_SCRIPT
exit 0
I made below script, I jsut wnat to make ftp connection and put file...but it not working....it is asking me for password and does not transfer file automatically
#!/usr/bin/expect -f
HOST='10.32.1.153'
USER='uninet\cacti.ftp'
PASSWD='cacti12345'
ftp $HOST <<END_SCRIPT
user $USER
$PASSWD
put a.txt
quit
END_SCRIPT
exit 0
~