![]() |
|
|
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 |
| alternate to set -x in csh scripts | sais | Shell Programming and Scripting | 3 | 10-12-2008 09:04 AM |
| alternate lines | pstanand | Shell Programming and Scripting | 6 | 03-18-2008 11:14 PM |
| option followed by : taking next option if argument missing with getopts | gurukottur | Shell Programming and Scripting | 2 | 03-17-2008 12:46 PM |
| Alternate way for echo. | senthil_is | Shell Programming and Scripting | 5 | 03-05-2008 09:12 AM |
| Alternate command for cut | Mohammed | Shell Programming and Scripting | 2 | 10-20-2006 08:42 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
I am new to Shell Scripting and I need help to write the following script in a different format... This is the current script: Code:
#!/usr/bin/ksh
environment=rms
export environment
. $AW_HOME/RETEK/exec/RETEK_ENVAR
ls -ltr $MMPOS/RTLOG* | tr -s " " | cut -d " " -f9 >$MMHOME/oracle/proc/bin/rtlogfiles.txt
touch $MMHOME/oracle/proc/bin/prom.1
while read LINE
do
saimptlogi_running=1
. $MMHOME/awbatch/refreshsql.sh saimptlogi
echo $LINE
mv $LINE $LINE.1
Date=`date "+%m%d%y%n"`
awrun -m saimptlogi -args 1 Y $LINE.1 $MMHOME/oracle/proc/bin/bad.1 $MMHOME/oracle/proc/bin/item.1 $MMHOME/oracle/proc/bin/waste.1 $MMHOME/oracle/proc/bin/ref_item.1 $MMHOME/oracle/proc/bin/prim_variant.1 $MMHOME/oracle/proc/bin/varupc.1 $MMHOME/oracle/proc/bin/storeday.1 $MMHOME/oracle/proc/bin/prom.1 $MMHOME/oracle/proc/bin/codes.1 $MMHOME/oracle/proc/bin/error.1 $MMHOME/oracle/proc/bin/ccval.1 $MMHOME/oracle/proc/bin/storepos.1 $MMHOME/oracle/proc/bin/tendertype.1 $MMHOME/oracle/proc/bin/merchcodes.1 $MMHOME/oracle/proc/bin/partner.1 $MMHOME/oracle/proc/bin/supplier.1 $MMHOME/oracle/proc/bin/employee.1 $MMHOME/oracle/proc/bin/banner.1 $MMHOME/oracle/proc/bin/ref_mmrp.1 $MMHOME/oracle/proc/bin/igtax.1 " " Y
sleep 140
done <$MMHOME/oracle/proc/bin/rtlogfiles.txt
sleep 90
while true
do
saimptlogi_running=`awexe jq |grep saimptlogi | grep -v REJ | wc -l`
if [ $saimptlogi_running = 0 ]; then
mv ls -ltr $MMPOS/RTLOG*.1 $MMHOME/arch
break
fi
done;
Actually I want a script which will not wait for the sleep(i;e I don't want sleep option) rather it should find for the PID in the log directory (Ex:- Jan_12.log Mon Jan 12 01:43:48 Program: saimptlogi: PID=12409: Started by rms Mon Jan 12 01:45:50 Program: saimptlogi: PID=12409: Thread 1 - Terminated Successfully )and it will ensure that if the same PID will appear again then it should assume that the current program is finished, then it should execute the next program. Can anyone please help me with it ... Last edited by otheus; 01-12-2009 at 11:10 AM.. Reason: Formatting and [code] tags |
| Bookmarks |
| Tags |
| scripting, shell |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|