Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

detecting success or failure of ftp automatically

Dermot Beirne
Frequent Advisor

detecting success or failure of ftp automatically

Hi,
I have an ftp process running from a shell script. It is something like this:

{
for host in nemail
do
echo "
open $host
user joe joepass
lcd /archive/dbeirne/admin/testdir1/
ascii
mput p*
close
"
done
} | ftp -i -n

I want to be alerted if the ftp fails for any reason, ie. cannot connected to the host, the username or password is incorrect, etc. I have tried using the standard $? variable, but this shows success even if the ftp fails. Is there a simple way of checking for failures of this type of script, and running a command like sending a page or whatever.

I know that I can grep through it's logfile for errors, but this is cumbersome as it's logfile is being appended to and is quite large, and contains some historic errors.

Thanks in advance.
Dermot.
Happy is harder than money. Anyone who thinks money will make them happy, doesn't have money.
1 REPLY
Dermot Beirne
Frequent Advisor

Re: detecting success or failure of ftp automatically

Sorry, I did not mean to post this in the database section of the forum.

Apologies, please ignore it!

Regards,
Dermot
Happy is harder than money. Anyone who thinks money will make them happy, doesn't have money.