Wants alternate to the Sleep option??


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Wants alternate to the Sleep option??
# 15  
Old 02-26-2009
I've edited my post, above. I was also missing "do" before the { .
# 16  
Old 03-02-2009
Code:
#!/usr/bin/ksh
#!/usr/bin/perl
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/wa
ste.1 $MMHOME/oracle/proc/bin/ref_item.1 $MMHOME/oracle/proc/bin/prim_variant.1 $MMHOME/oracle/proc/bin/varupc.1 $MMHOME/orac
le/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/merc
hcodes.1 $MMHOME/oracle/proc/bin/partner.1 $MMHOME/oracle/proc/bin/supplier.1 $MMHOME/oracle/proc/bin/employee.1 $MMHOME/orac
le/proc/bin/banner.1 $MMHOME/oracle/proc/bin/ref_mmrp.1 $MMHOME/oracle/proc/bin/igtax.1 " " Y
#./saimptlogi rms/rms52dev@rms $LINE.1 $MMHOME/oracle/proc/bin/bad.1 $MMHOME/oracle/proc/bin/item.1 $MMHOME/oracle/proc/bin/w
aste.1 $MMHOME/oracle/proc/bin/ref_item.1 $MMHOME/oracle/proc/bin/prim_variant.1 $MMHOME/oracle/proc/bin/varupc.1 $MMHOME/ora
cle/proc/bin/storeday.1 $MMHOME/oracle/proc/bin/prom.1 $MMHOME/oracle/proc/bin/codes.1 $MMHOME/oracle/proc/bin/error.1 $MMHOM
E/oracle/proc/bin/ccval.1 $MMHOME/oracle/proc/bin/storepos.1 $MMHOME/oracle/proc/bin/tendertype.1 $MMHOME/oracle/proc/bin/mer
chcodes.1 $MMHOME/oracle/proc/bin/partner.1 $MMHOME/oracle/proc/bin/supplier.1 $MMHOME/oracle/proc/bin/employee.1 $MMHOME/ora
cle/proc/bin/banner.1 $MMHOME/oracle/proc/bin/ref_mmrp.1 $MMHOME/oracle/proc/bin/igtax.1
cd $MMHOME/log
logfile=$(ls -ltr|tail -1|cut -c 55-70)
if ! tail -2f $logfile | perl -ne '/saimptlogi/ && /PID=([0-9]+):/ && do { $pid{$1}++; exit 1 if ($pid{$1} >= 2)}'
then
        echo "Started"
fi
done <$MMHOME/oracle/proc/bin/rtlogfiles.txt

Is it possible to take the line count from $MMHOME/oracle/proc/bin/rtlogfiles.txt and assign it to a variable called line_cnt and then the internal loop should run till the last file count ...This will be great ...because currently even before the last job will be still running this main batch it getting finished...This should not happen actually....Only after completion of all the dependent jobs this main batch should finish....Is there any way....
# 17  
Old 03-02-2009
Bug

Quote:
Originally Posted by otheus
I've edited my post, above. I was also missing "do" before the { .

What this "do" will do ???
# 18  
Old 03-03-2009
Lightbulb

Code:
#!/usr/bin/ksh
#!/usr/bin/perl
set -x
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
x=`cat $MMHOME/oracle/proc/bin/rtlogfiles.txt | wc -l`
touch $MMHOME/oracle/proc/bin/prom.1
i=1
while[$x -ge $i]
do
  read LINE
  saimptlogi_running=1
  . $MMHOME/awbatch/refreshsql.sh saimptlogi
  echo $LINE
  mv $LINE $LINE.1
  Date=`date "+%m%d%y%n"`
 ./saimptlogi rms/rms52dev@rms $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 \
 cd $MMHOME/log
 logfile=$(ls -ltr|tail -1|cut -c 55-70)
 if ! tail -2f $logfile | perl -ne '/saimptlogi/ && /PID=([0-9]+):/ && do { $pid{$1}++; exit 1 if ($pid{$1} >= 2)}'
 then
        echo "Started"
 fi
 i=`expr $i + 1`
done <$MMHOME/oracle/proc/bin/rtlogfiles.txt

Hi Otheus.....I am trying to run the above batch in appworx but the parent batch saimptlogi_batch is getting finishes soon even as the child batches saimptlogi will still be running...this should not happen.....can you please help me...how I can modify it so that the parent batch should not get finish till the last dependent job gets finishes......Please guide me....thanks....

Last edited by otheus; 03-03-2009 at 11:28 AM.. Reason: broke up long lines
# 19  
Old 03-03-2009
Data

Please anyone can help me out in this one....I need this very urgently....
# 20  
Old 03-03-2009
What are the "parent" and "child" batches?

What does $MMHOME/awbatch/refreshsql.sh look like?

Why are you using " logfile=$(ls -ltr|tail -1|cut -c 55-70)" ? Don't you know the name of the logfile? How can you be sure it is the most recently modified entry in this directory?
# 21  
Old 03-04-2009
Power

Quote:
What are the "parent" and "child" batches?
Actually the main script which i posted yesterday is saimptlogi_batch.sh and i am submitting this script in a job scheduler call "AppWorx" ....What this script does is it consume some file called RTLOG* in the $MMPOS directory.After consuming it will rename the file with .1 extension..Each file consumption takes atleast 2:30 to 3:mins...so when I am submitting this script which is named as saimptlogi_batch in appworx,it is starting another sub module call saimptlogi which is for an individual RTLOG file...Once one saimptlogi finishes another saimptlogi is starting...like this it will run one after another till the number of files present in rtlogfiles.txt.....and till all the files will not be consumed the main batch saimptlogi_batch should be running......when I am submitting the main batch saimptlogi_batch,it is starting the sub modules called saimptlogi but it itself is getting finished in few seconds....I want the main batch to run till the last RTLOG consumption...

Quote:
What does $MMHOME/awbatch/refreshsql.sh look like?
#!/bin/ksh
PROG="'`echo $1`'"
sqlplus -silent $db_login/$db_password@rms <<EOF
variable p_prog varchar2
execute mg_refresh($PROG);
exit;
EOF

Quote:
Why are you using " logfile=$(ls -ltr|tail -1|cut -c 55-70)" ? Don't you know the name of the logfile? How can you be sure it is the most recently modified entry in this directory?
it is the most recently modified entry in this directory?
Though I know the logfile name...it will recent day name and it looks like below:

-rw-rw-rw- 1 appworx dba 1024 Mar 4 10:03 Mar_04.log

Only this log files will be there in this directory and ls -ltr|tail -1 will get me the last modified file..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Unrecognized option: sparc-sun-Solaris2.10/bin/as: unrecognized option `-m32'

Hi, I installed some packages required by an app built with python. But when I try python setup.py install, I get the following error: /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.2.0/../../../../sparc-sun-solaris2.10/bin/as: unrecognized option `-m32' Could anyone tell me what's wrong... (4 Replies)
Discussion started by: Kimkun
4 Replies

2. HP-UX

Alternate for wget

Hi, Whats the alternate for wget in HP-UX ? (4 Replies)
Discussion started by: mohtashims
4 Replies

3. UNIX for Dummies Questions & Answers

Alternate for pwdx in HPUX

I need alternate command as pwdx does not work on HP-UX mymachine B.11.31 U ia64 3223107173 unlimited-user license (6 Replies)
Discussion started by: mohtashims
6 Replies

4. Shell Programming and Scripting

Alternate to SLEEP for EXPECT within BASH script?

Fairly new to the System Admin world, and this is my first post here, hoping to get some clarification. I am using a BASH script to automate some Logfile Archiving (into .tars). The actual logfiles are accessed through an SSH, so I have used the following EXPECT sub-script within my main BASH... (8 Replies)
Discussion started by: Goatfarmer03
8 Replies

5. Shell Programming and Scripting

recently introduced to the newer option for find...does an older option exist?

To find all the files in your home directory that have been edited in some way since the last tar file, use this command: find . -newer backup.tar.gz Is anyone familiar with an older solution? looking to identify files older then 15mins across several directories. thanks, manny (2 Replies)
Discussion started by: mr_manny
2 Replies

6. Shell Programming and Scripting

Wrapping 'sleep' with my 'resleep' function (Resettable sleep)

This is a very crude attempt in Bash at something that I needed but didn't seem to find in the 'sleep' command. However, I would like to be able to do it without the need for the temp file. Please go easy on me if this is already possible in some other way: How many times have you used the... (5 Replies)
Discussion started by: deckard
5 Replies

7. Shell Programming and Scripting

alternate lines

Hi, I'm new to Unix. I want to read the all the lines from a text file and write the alternate lines into another file. Please give me a shell script solution. file1 ----- one two three four five six seven newfile(it should contain the alternate lines from the file1) ------- one... (6 Replies)
Discussion started by: pstanand
6 Replies

8. Shell Programming and Scripting

option followed by : taking next option if argument missing with getopts

Hi all, I am parsing command line options using getopts. The problem is that mandatory argument options following ":" is taking next option as argument if it is not followed by any argument. Below is the script: while getopts :hd:t:s:l:p:f: opt do case "$opt" in -h|-\?)... (2 Replies)
Discussion started by: gurukottur
2 Replies

9. Shell Programming and Scripting

Alternate way for echo.

Hi, Is there any other command echo does. if I am doing this operation for each line in my file. So its taking very long time to process more than 1000 records. Is there any alternative way to write the above if statement (5 Replies)
Discussion started by: senthil_is
5 Replies
Login or Register to Ask a Question