The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 01-12-2009
satyajit007 satyajit007 is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 18
Lightbulb Need help to write a shell script without Sleep option??

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
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:35 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0