![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| exiting from script | arghya_owen | Shell Programming and Scripting | 1 | 06-02-2008 06:36 AM |
| Exiting from script when error occurs | Sreejith_VK | Shell Programming and Scripting | 4 | 04-25-2008 03:53 AM |
| PHP5 Script 'Freeze' before exiting | Unbeliever | Shell Programming and Scripting | 4 | 05-10-2007 11:32 AM |
| Shell script not exiting Gracefully | smithK | Shell Programming and Scripting | 5 | 02-08-2007 06:48 PM |
| exiting in c | ruffenator | High Level Programming | 3 | 04-28-2002 02:31 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Script Not Exiting???
I have a shell script that runs an Oracle Export and compresses the export dump file as it is processing to a pipe.
It runs fine except I tested how it worked when the database is down. The script seemed to work correctly . It identified that the database was down and sent out an email but for some reason the process did not exit out. It is still out there. Eventhough I have a return 1 after the email is sent. Does anyone know why this is happening. On am on Solaris using KSH. Here is my script: # variable declaration . /export/home/oracle/.MYenv LOGDIR=/xxxx # log of this script typeset shlog shlog=${LOGDIR}/export_full_${ORACLE_SID}.$$.log touch ${shlog} print "starting `date` ${0} ${@}" >>${shlog} 2>&1 print "Move old exports to proper directories" >>${shlog} 2>&1 exp_arch[1]=${EXPDIR} DMPFILE=${EXPDIR}/exp_full_${ORACLE_SID}.`date +"%Y%m%d"`.dmp LOGFILE=${LOGDIR}/exp_full_${ORACLE_SID}.`date +"%Y%m%d"`.log # delete old files rm -f ${EXPDIR}/*pipe* rm -f ${DMPFILE} ${DMPFILE}.Z ${LOGFILE} #pipe name mknod ${EXPDIR}/${SOURCE}fcompress p chmod 644 ${EXPDIR}/${SOURCE}fcompress print "Start Compress Pipe" >> ${shlog} compress < ${EXPDIR}/${SOURCE}fcompress > ${DMPFILE}.Z & TMPDIR=/xxxxx errorfile=${TMPDIR}/errcheckf$$.${ORACLE_SID} touch ${errorfile} print "Begin Export\n" >> ${shlog} export ORACLE_SID=${ORACLE_SID} $ORACLE_HOME/bin/exp userid=${xxxx}/${xxx} file=${EXPDIR}/${SOURCE}fcompress log=${LOGFILE} DIRECT=Y FULL=Y >>${shlog} 2>&1 # check for export errors cat ${LOGFILE} | grep EXP-000 | grep -v EXP-00067 >> ${errorfile} bkpemail=xxxxx@us.hsbc.com if [ -s "${errorfile}" ] then print "\nError in full export of ${ORACLE_SID} database!\n" >> ${shlog} print "Ending program ${@} `date` ${0}." >>${shlog} 2>&1 mailx -s "(${ORACLE_SID}) Full Database Export Error" ${bkpemail} < ${shlog} cat ${shlog} return 1 fi print "Export was Successful!" >> ${shlog} rm -f ${errorfile} rm -f ${EXPDIR}/*fcompress* print "Cleanup log files\n" >> ${shlog} #clean up files find ${LOGDIR}/export_full_${ORACLE_SID}*.log -type f -mtime +7 -print | xargs rm -f find ${LOGDIR}/exp_full_${ORACLE_SID}*.log -type f -mtime +7 -print | xargs rm -f print "Ending program ${@} `date`${0}." >>${shlog} 2>&1 return 0 |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|