Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Unix script question

RE: Unix script question

From: lerobe - Lee Robertson <LEROBE_at_acxiom.co.uk>
Date: Thu, 01 Feb 2001 09:32:25 -0800
Message-ID: <F001.002A7834.20010201090049@fatcity.com>

Erm.... you have done it on your own.

At the foot of your script where you check for the file existing, you have a ! -s. This checks that the file exists and is 0 bytes. If you did not have the ! character the statement would check that the file exists and has a size greater than 0.

-----Original Message-----
Sent: 01 February 2001 16:27
To: Multiple recipients of list ORACLE-L

check the man page;
$ man test

> -----Original Message-----
> From: root_at_fatcity.com [mailto:root_at_fatcity.com]On Behalf Of Roy
> Ferguson
> Sent: Wednesday, January 31, 2001 2:48 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Unix script question
>
>
> I am looking to resolve an issue we have with a particular script.
>
> using a unix script, I need to determine if a file exists and if
> the size of the
> file is zero bytes. using ftp, we put a file a file on a server
> then we use get
> to retreive the same file back. we do this to ensure that the
> file has been sent
> successfully. once the file is gotten back, using get, we
> compare the original
> file to the get file. we then use if to see if the file was
> successfully send
> and received back. if the file is not gotten back, we email the
> necessary
> people of the error. if the files are different sizes, we email
> the necessary
> people that the file sizes do not match and that the ftp process
> needs to be
> done again. all of the above steps work fine.
>
> the issue we face is when we ftp a zero byte file and receive the
> same file back
> the if statement we're using sees the zero byte file as none existant and
> therefore an email is sent saying that the ftp process failed
> when in fact it
> didn't. it just sent and received a zero byte file. a zero byte
> file is not a
> failed process.
>
> finally...the question...
>
> can a unix scripting guru assist me in the code that checks if a
> file is a zero
> byte file?
>
> thanks in advance...Roy
>
> below is the current portion of the script that checks for errors:
>
>
> put file1 'file1'
> get 'file1' check_file
> bye
> !EOF
>
>
> # First if statement will check to see if the check file exists
>
> if test ! -s "check_file"
> then
>
> # if the file does not exist, send the failed message and exit the program
>
> echo Failed to pull a check file back from the FTP
> echodo /usr/ucb/mail -s ftp_of_file1.FAILED `cat $EMAIL/fail.list` <
> $EMAIL/fail.msg
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Roy Ferguson
> INET: rferguso_at_level1.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Glenn Travis
  INET: Glenn.Travis_at_wcom.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).


The information contained in this communication is
confidential, is intended only for the use of the recipient
named above, and may be legally privileged. If the reader 
of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  
If you have received this communication in error, please 
re-send this communication to the sender and delete the 
original message or any copy of it from your computer
system.
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: lerobe - Lee Robertson
  INET: LEROBE_at_acxiom.co.uk

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Feb 01 2001 - 11:32:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US