[HPADM] SUMMARY: FTP return codes

From: Quinn, Bryan (Bryan.Quinn@CooperTools.com)
Date: Mon Dec 09 2002 - 16:34:14 EST


Thanks to everyone who responded!

I used the basic structure that Neeraj Lal provided and modified to fit my
situation a little better. Below is the syntax that I used and below that is
Neeraj's response. At the very bottom is my original post.

My Syntax:

ftp -n -v < $tmp_file > $err 2>&1

grep 'Transfer complete.' $err > /dev/null

if [ $? -eq 0 ]
then
       some command
else
       some other command
fi

Neeraj's Suggestion:

cat $DATA_DIR/scriptx.ftp | ftp -v -n > $DATA_DIR/ftp.err

grep 'Transfer completed successfully.' $DATA_DIR/ftp.err > /dev/null

if [ $? -eq 0 ]
do something
else
report error
fi

        My Original Post:
> Hello Admins,
>
> Got a question as usual. I am in the process of writing a script that will
> monitor an ftp from our UNIX box to a Windows box. I have tried checking
> using the following if statement, which seems to be something is used
> quite
> regularly in scripts, but this does not seem to work if you have an error.
>
> status=$?
>
> if [ $status != "0" ]
> then
> do something
> else
> do something else
> fi
>
> Does anyone have any thing else I can try.
>
> Thanks!
> Bryan Douglas Quinn
> UNIX Support Specialist
> Cooper Power Tools
> Lexington, SC
> (803) 808-6770
> Bryan.Quinn@coopertools.com
>
>
>
> --
> ---> Please post QUESTIONS and SUMMARIES only!! <---
> To subscribe/unsubscribe to this list, contact
> majordomo@dutchworks.nl
> Name: hpux-admin@dutchworks.nl Owner:
> owner-hpux-admin@dutchworks.nl
>
> Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin (FTP, browse
> only)
> http://www.dutchworks.nl/htbin/hpsysadmin (Web, browse &
> search)

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:23 EDT