![]() |
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 |
| comparing 2 files using nested for loop | vadharah | Shell Programming and Scripting | 0 | 03-01-2008 04:32 AM |
| Nested loop not running using cronjob | bihani4u | Shell Programming and Scripting | 9 | 09-26-2007 11:19 AM |
| Variable in While Loop Nested If | geass | Shell Programming and Scripting | 6 | 03-26-2007 06:09 PM |
| Nested Loop to Echo Multiple Arrays | yongho | Shell Programming and Scripting | 1 | 07-12-2005 11:35 AM |
| Nested while read line loop | Rakker | Shell Programming and Scripting | 7 | 06-24-2005 07:42 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Korn shell on a HP but the code will also run on AIX.
The code is very big but here is the piece that is not working if [ "${ALERT}" ] then set -x desc="performing maintenance on the Oracle alerts logs." echo "\n${desc}\n" >> ${logfile} export dblist=$(grep -v "#" ${oratab} | awk -F: '{print $1}') echo "${dblist}" | while read db do while true do export sid=${db} alertlog="alert_${sid}.log" echo "\nprocessing ${alertlog}." >> ${logfile} orauser=${admin}/${sid}/.orauser_${sid} if test ! -r "${orauser}" then errmsg=${main}.${today}.msg echo "unable to read ${orauser}" > ${errmsg} send_message ${maillist} ${errmsg} echo "\nunable to read ${orauser}." >> ${logfile} break fi . ${admin}/${sid}/.orauser_${sid} echo "\nsql query for background_dump_desc from ${sid}." >> ${logfile} sqlcmd=${workdir}/${main}.alertlog.${today}.sql sqllog=${workdir}/${main}.alertlog.${today}.log rm -f ${sqlcmd} ${sqllog} echo "set termout off" > ${sqlcmd} echo "set pagesize 0" >> ${sqlcmd} echo "set linesize 1024" >> ${sqlcmd} echo "set trimspool on" >> ${sqlcmd} echo "set heading off" >> ${sqlcmd} echo "set feedback off" >> ${sqlcmd} echo "set verify off" >> ${sqlcmd} echo "whenever sqlerror warning" >> ${sqlcmd} echo "spool ${sqllog}" >> ${sqlcmd} echo "select value from v\$parameter" >> ${sqlcmd} echo " where name = 'background_dump_dest';" >> ${sqlcmd} echo "exit" >> ${sqlcmd} systempwd=$(get_pwd ${node} ${sid} system) (sqlplus -S system/${systempwd} @${sqlcmd}) >> ${logfile} if [ "${status}" -ne 0 ] then errmsg=${main}.${today}.msg echo "error ${status} retriving background_dump_dest \c" >> ${logfile} echo "from ${sid}." > ${errmsg} send_message ${maillist} ${errmsg} echo "error ${status} retriving background_dump_dest \c" >> ${logfile} echo "from ${sid}." >> ${logfile} break fi bdump=$(cat ${sqllog}) echo "\nsqlplus query successful. bdump = ${bdump}\n" >> ${logfile} rm -f ${sqlcmd} ${sqllog} timestamp=$(gettimestamp) archive="${alertlog}.${timestamp}" cp -fp ${bdump}/${alertlog} ${bdump}/${archive} echo "\narchiving ${alertlog} to TSM." >> ${logfile} archive_file ${bdump} ${archive} ${mca} status=$? if [ "${status}" -ne 0 ] then errmsg=${main}.${today}.msg echo "error ${status} archiving ${archive} to TSM." > ${errmsg} send_message ${maillist} ${errmsg} echo "error ${status} archiving ${archive} to TSM." >> ${logfile} echo "restoring ${alertlog} to original state." >> ${logfile} tmpfile=${workdir}/${main}.tmp cmd="cat ${bdump}/${archive} ${bdump}/${alertlog} > ${tmpfile}; " cmd="${cmd} mv -f ${tmpfile} ${bdump}/${alertlog}; " cmd="rm -f ${bdump}/${archive} ${tmpfile}" (${cmd}) break fi rm -f ${bdump}/${archive} echo "\ntruncating file ${bdump}/${alertlog}" >> ${logfile} truncate_file ${bdump}/${alertlog} status=$? if [ "${status}" -ne 0 ] then errmsg=${main}.${today}.msg echo "error ${status} truncating ${bdump}\c" > ${errmsg} echo "/${alertlog}." >> ${errmsg} send_message ${maillist} ${errmsg} echo "error ${status} truncating ${bdump}/\c" >> ${logfile} echo "${alertlog}." >> ${logfile} continue fi echo "\nfile truncated successfully.\n" >> ${logfile} break done done fi |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|