By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,589 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,589 IT Pros & Developers. It's quick & easy.

Help with a bash ftp script

alpnz
100+
P: 113
I keep getting an error on the windows login of the following script. Any ideas anyone?

Expand|Select|Wrap|Line Numbers
  1. #!/bin/sh
  2. #A script to move files across a network, which has strict firewalling, and only one gateway computer.
  3. #No issues with PASV other than it does not function well through the firewall.
  4.  
  5. #Define the server to get the files from, and the files I want (It is a Windows ftp server, that I can connect too.)
  6.  
  7. HOST="192.168.195.195"
  8. USER="user1"
  9. PASS="alibaba1"
  10. FILE11=clientraw.txt
  11. FILE22=clientrawdaily.txt
  12. FILE33=clientrawextra.txt
  13.  
  14.  
  15. #Define the server I want to put the files into.
  16.  
  17. HOST1="ftp.somewhere.on.the.net"
  18. USER1="user2"
  19. PASSWD1="alibaba2"
  20. FILE1=/scripts/wxdata/clientraw.txt
  21. FILE2=/scripts/wxdata/clientrawdaily.txt
  22. FILE3=/scripts/wxdata/clientrawextra.txt
  23.  
  24. #Go get the files from the windows box too the Linux gateway server. (Stalls at the password stage on the windows server.)
  25.  
  26. ftp -n $HOST PASV<<END_SCRIPT
  27. quote USER $USER
  28. quote PASS $PASS
  29. get $FILE11    /scripts/wxdata/clientraw.txt
  30. get $FILE22    /scripts/wxdata/clientrawdaily.txt
  31. get $FILE33    /scripts/wxdata/clientrawextra.txt
  32. quit
  33. END_SCRIPT
  34.  
  35. #Put the files where I want. (This part works fine)
  36.  
  37. ftp -n $HOST1 <<END_SCRIPT
  38. quote USER $USER1
  39. quote PASS $PASSWD1
  40. put $FILE1 /htdocs/wx/clientraw.txt
  41. put $FILE2 /htdocs/wx/clientrawdaily.txt
  42. put $FILE3 /htdocs/wx/clientrawextra.txt
  43. quit
  44. END_SCRIPT
  45. exit 0
  46.  
  47.  
Any help appreciated.
Feb 25 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.