Forum Moderators: phranque

Message Too Old, No Replies

need help with ftp

from server to server

         

StuntasticAudi

2:54 pm on Feb 16, 2006 (gmt 0)

10+ Year Member



Hey guys! I hope someone could help me with this issue. I need to know how to do this or a script that will run this:

ftp download from server a
then ftp upload that same file to server b

I would like this script to run every 5 minutes.

encyclo

3:15 pm on Feb 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1. Why the two-step process? Why not FTP from server A to server B directly if the file is unchanged?

2. What is the server A running? Windows, Linux...?

StuntasticAudi

3:19 pm on Feb 16, 2006 (gmt 0)

10+ Year Member



both linux, they're not my own dedicated servers!
I have a folder stored with one of my hosts and i just need to copy that folder to a different host but i need this to be done like every couple minutes.

physics

8:16 pm on Feb 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you're able to use crontab on the source server you could schedule a direct transfer from A to B every couple minutes.
Try
crontab -e
For what the crontab entry format is:
man 5 crontab

In your crontab on server A I think you'd want something like this


*/3 * * * * cd /home/you/yourdir; echo -e "quote USER yourBftpuser\nquote PASS yourBftppass\nput yourfile.txt\nquit" ¦ ftp -n serverB.example.com

(Disclaimer: this would put your ftp password to B in plain text on A which you may not want to do.)

If you don't have crontab access at server A and do have a Linux type system at home you can do A->home, home->B using something similar to the code above in your home crontab.