#!/bin/sh
for ip in $(cat /root/Desktop/ftp.txt)
do
HOST=$ip
USER='bob'
PASS='bob'
ftp -n $HOST <<EOF
user bob bob
EOF
echo "$ip"
done
the Above code i want to use check and verify login works on multiple ftp servers on my network. However the ftp servers are dynamic in setup and change between a range of ip's. So this script does what i need, except when an ftp server is down it freezes, because there is no timeout. If someone could please give a suggestion as to what i could do, i would appreciate it. I know this is a simple buggy script, but im just starting out and want to get it to work.
Cheers,
why dont you ping the server first and if u get response, then check the ftp functionality
You can make use of ping foe this issue
#!/bin/ksh
for ip in $(cat ~/test/ftp.txt)
do
HOST=$ip
USER='bob'
PASS='bob'
ping -c 1 -w 1 $HOST >/dev/null 2>&1
if [ $? -ne 0 ]
then
continue
fi
ftp -n $HOST <<EOF
user bob bob
EOF
echo "$ip"
done
If your OS is solaris, just use ping $HOST
regards,
Ahamed
Dont use cat -- Useless Use of Cat Award
$(cat /root/Desktop/ftp.txt)
use it like this
while read ip
do
....
....
....
done < ~/test/ftp.txt
Hi, I need some help regarding login issue. I have to use 8 server. The username is same at all. But when i was trying to access for particular 4 server. I got access denied error. Please help ....
Note: If i change my password by using root user. then I can able to enter into the same server. But After some time i cant able to enter into the same server. Please advice the same.
Thanks,
Mani
thank you, although this did solve part of my problem, sometimes the ftp server im attempting
to connect too freezes or dosent allow connections from my specific IP address, in this case
the script freezes because the ftp server does not close. Is there any timeout command that i
could add in to close the session after like 10 seconds or something.
cheers!
#!/bin/sh
for ip in $(cat /root/Desktop/ftp.txt)
do
HOST=$ip
USER='bob'
PASS='bob'
ftp -n $HOST <<EOF
user bob bob
EOF
echo "$ip"
done