FTPing backup files to another server

I am running a hot backup of my database every night within our cronjob. Recently I got burned because the tape which holds my backups became corrupt. I am setting up another Sun box to hold my backups as well as writing them to tape. I know dumb error on my part. My question is what will I have to do to automate the ftp action to move the backup file to the backup server every night with some sort of script or command? I would like to have this done by the machine. I am not a Unix guru and would like some help if anyone has any ideas on this. Thanks for the input!
FRL

There's some samples out there that can help you if you do a search on 'automate ftp', etc.

This is relatively easy to set up so you shouldn't have any problems. If you have some problems after you tried out some scripts then let us know.

Gianni.

I have found a script and tried it to no avail. I get the following error.

Warning: tcgetattr failed in ssh_rl_set_tty_modes: Inappropriate ioctl for device

I got the following script from this site and used it. I got it to ask for my password but that isn't what I'm aiming for. I need this thing to run at night on it's own. And it asked me for my root password not the password for the user I specified in the script. I know what all the lines are for except the first and the 5th (lcd....). Can someone explain what those are doing for me. I think I'm on the right track, just need some more directions.

sftp IP ADDRESS<<end
user uname pword
cd /security1
bin
put filename
bye
end

If you use tar you can backup remotely:

tar -czvf machine_name:/home/user/backup.tar.gz /dir2/backup

:wink:

Is this the equivilent of the Win32 SMB \\servername\sharename method of accesing a sub-dir or file without mapping a drive?

I reckon tonight Iwill have to see if I can get from my OpenBSD to my FreeBSD machine this way. I use the \\servername all the time at work and would like to be able to do similiar under Unix.

I got that tip from man tar - however, whenever I try to use it I get an error about being unable to access the archive - I presume I need to setup some form of allowance on my FreeBSD box?

Any ideas which file?

would tar -czvf machine_name:/home/user/backup.tar.gz /dir2/backup work across network for linux/unix boxes, to the tape drives?

tar -czvf machine_name:/dev/rmt/st0/backup.tar.gz /myhomedir/

would this work?

I have NFS shares enabled from my FreeBSD box to my OpenBSD box but don't have the shares mounted right at the moment. I didn't get a chance to try this out this past weekend. Maybe today I will putty into my boxes and give it a try.

tar cvf - * | rsh <RemoteHost> dd of=<YourFile>

or

tar cvf - * | rsh <RemoteHost> gzip backup.tar

I can't get rsh to work in that command, always starts to act like it is going to work and then says access denied.
Any ideas? i can ftp and telnet just fine.

With ftp and telnet you are giving it a username/password. In the way you are using rsh, you will need to set up the /etc/hosts.equiv files (or equivalent for your OS). Check out the man page on rsh and hosts.equiv.

And also check up on security issues for using rsh. It may be against your company's policy.