Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ftp single file to multiple sites 1

Status
Not open for further replies.

dwcasey

MIS
Oct 31, 2002
179
US
I am wondering if ksh is capable of reading in a list of hostnames and then ftp'ing a file to each host in the same directory?

If I have a file called hosts.lst and then just run and ftp loop reading in each line of hosts.lst.

I have the following ,but it's reading the whole file:

#!/usr/bin/ksh

user="root"
HOSTS="/home/dcasey/hosts.lst"

HOSTS="`cat /home/dcasey/hosts.lst`"
for i in "$HOSTS"; do
echo ftp -v -n $i << EOF
user $user
cd /home/user01/logs
lcd /home/user02
bin
hash
put file.tar
quit
EOF
done
 
What about this ?
#!/usr/bin/ksh
user="root"
for i in $(</home/dcasey/hosts.lst); do
ftp -v -n $i << EOF
user $user
cd /home/user01/logs
lcd /home/user02
bin
hash
put file.tar
quit
EOF
done

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Much better. But now I'm being told to use COPY after my hash...does put not work?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top