UNIX script problem

UNIX script problem

 

  

Hi! I need some help with the following code as I have little experience with Korn Shell.

This is part of an auto refresh script for our test databases that checks for a copy of the production dmp file and then imports it and makes other changes to the test db. If the export from production fails, and the dmp file size is 0, adding this code will cause the job will to stop. However if the file is OK and has the usual still run, but there is not data. If the file is the usual 3.7 G of data, if will also now fail. Any suggestions as to how to code this so it will not run if the file is empty, and run if the file is OK?

If I remove the '!' from the -s then the script runs if the file is 0 and if it is OK.


#
# Do not process if file size = 0 bytes.
#
if ! [ -s $LOCAL_FILE ]
then
echo " <$LOCAL_FILE> Not processed because file size=0 bytes." >> $LOGFILE
Scr_Exit 0
fi


(NT 4.0, Oracle 7.3.4.5.2, we use Korn Shell scripts through Telnet sessions)

Thanks, Renee


AFSC is now online, please visit: www.afsc.ca < http://www.afsc.ca <http://www.afsc.ca/> >

This communication is intended for the use of the recipient to which it is addressed, and may contain confidential, personal and/or privileged information. Please contact us immediately if you are not the intended recipient of this communication, and do not copy, distribute, or take action relying on it. Any communication received in error, or subsequent reply, should be deleted or destroyed.



Oracle LazyDBA home page