Visit Our UNIX and Linux User Community


script dont' break out


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers script dont' break out
# 1  
Old 10-15-2009
script dont' break out

I have concurrent manager stop and check to verify all the process are stopped BUT even after all the process are stopped query script continues to run without break out.

Code:
# stop the concurrent manager
$COMMON_TOP/admin/scripts/$CONTEXT_NAME/adstpall.sh $DB_USER/$DB_PSWD
# check if the processes are alive
SPOOL_FILE="$APPLTMP/stop_cm_$TWO_TASK.tmp"
while : ; do
sqlplus -silent $DB_USER/$DB_PSWD << EOF
spool $SPOOL_FILE
select concurrent_queue_name, running_processes
from fnd_concurrent_queues
where running_processes > 0;
spool off
EOF
egrep -s "no rows selected" $SPOOL_FILE
RETURN_VALUE=$?
if [ $RETURN_VALUE -ne 0 ]
then
  echo "Current manager processes are still active. Sleeping for 10 seconds..."
  sleep 10
fi
done
rm $SPOOL_FILE
echo "** Concurrent Manager and its processes are stopped **"

and following line no rows selected continues to run wihtout stopping

Will be big help if some one can guide to where I'm not doing it right.


thank you
# 2  
Old 10-15-2009
Code:
# stop the concurrent manager
$COMMON_TOP/admin/scripts/$CONTEXT_NAME/adstpall.sh $DB_USER/$DB_PSWD
# check if the processes are alive
SPOOL_FILE="$APPLTMP/stop_cm_$TWO_TASK.tmp"
while : ; do
    sqlplus -silent $DB_USER/$DB_PSWD << EOF
    spool $SPOOL_FILE
    select concurrent_queue_name, running_processes
    from fnd_concurrent_queues
    where running_processes > 0;
    spool off
    EOF
    egrep -s "no rows selected" $SPOOL_FILE
    RETURN_VALUE=$?
    if [ $RETURN_VALUE -ne 0 ]
    then
      echo "Current manager processes are still active. Sleeping for 10 seconds..."
      sleep 10
    else 
      break
    fi
done

rm $SPOOL_FILE
echo "** Concurrent Manager and its processes are stopped **"

 

Previous Thread | Next Thread
Test Your Knowledge in Computers #90
Difficulty: Easy
If you open vi specify a path to a file that does not exist, vi will create a new, blank file at that location in the filesystem and open it.
True or False?

10 More Discussions You Might Find Interesting

1. Programming

Shell script - if statements dont work

hi all, i have made a shell script and it runs until it reaches the if statement, doesn't the ! mean only if the command fails it will echo me that message and then exit can anyone please help me what is wrong with my code? many thanks, rob #!/bin/bash echo "is this archive... (10 Replies)
Discussion started by: robertkwild
10 Replies

2. Shell Programming and Scripting

Need Help on simple script as i dont know numch about UNIX scripting

Hello All, My name is vasu and I am very new to Unix scripting, i know basic commands, but now i need to write the following script, i have tried but no luck My requirment is i am getting one our from another command as following Used:1.8TB Advisory Quota:1.8TB aaa1 Used:4.5TB Advisory... (1 Reply)
Discussion started by: VasuKukkapalli
1 Replies

3. Ubuntu

Dont Allow Exitting from a Script

Hello, I wrote a script and disabled Ctrl+C using trap ' ' 2 For security, I cannot allow users to exit the script on their own for then they would have access to the command prompt. Are there any other cases that I need to cover? Thank you. I'm new to scripting. (6 Replies)
Discussion started by: fzivkovi
6 Replies

4. UNIX for Dummies Questions & Answers

Bash script dont works when executed as cronjob

Hello, i have cronjob: crontab -l * * * * * pkill -f domexpcheck;sh /root/dom/domexpcheck.sh it runs: /var/log/cron Mar 25 12:11:01 vps crond: (root) CMD (pkill -f domexpcheck;sh /root/dom/domexpcheck.sh) but somehow script dont run properly via cronjob. But when i execute cronjob... (7 Replies)
Discussion started by: postcd
7 Replies

5. UNIX for Dummies Questions & Answers

Call a UNIX script inside another and dont wait for it

Hi I have two scripts script1.sh and script2.sh(say this script is a long running). I want to call script2.sh inside and script1.sh,but when i call script2.sh i dont want to wait for script2 to complete and want this to run in back ground and go on next commands in script 1.sh and finally at the... (2 Replies)
Discussion started by: lijjumathew
2 Replies

6. Shell Programming and Scripting

Dont want to mention user id passwd in shell script

Hi, i have one shell script which transfers files from one server to other server through FTP, but i can see login id and password is not mentioned. kindly help to understand the script.then how below script is working if login and password is not mentioned in script #!/bin/sh... (1 Reply)
Discussion started by: ni3b007
1 Replies

7. Shell Programming and Scripting

something is causing this script to break early on

I am relatively new at scripting in linux. Most of my scripting knowledge comes from doing batch scripting in windows. Anyway, I have this script I'm trying to write that will install a program called Nagios along with a few other packages. I know it has to be something at the beginning that is... (4 Replies)
Discussion started by: nanite51
4 Replies

8. UNIX for Dummies Questions & Answers

how to break within a case/esac and stay in script

Wrote the following loop to but if I use exit, then I break entirely from my script, but instead I want to break from the case/esac and go to the next line in my script. I guess I need to know how to exit gracefully from a "while (true). Also, how can I allow the user to enter upper or lowercase... (4 Replies)
Discussion started by: tumblez
4 Replies

9. Shell Programming and Scripting

command << EOF(dont want to call other script)

Dear Freinds, Help needed in input redirection . My problem is as follows.. I have a shell script as follows which calls another gnuplot script . datagen.sh #!/bin/ksh gnuplot plot_I.plt In the above file I am calling another file called plot_I.plt which reside in the same... (4 Replies)
Discussion started by: user_prady
4 Replies

10. Shell Programming and Scripting

ksh script: 'exit' being treated as 'break 2'

hi, in a korn shell script, has anyone ever seen an 'exit' being treated as a 'break 2'? I have a script which has 3 nested loops. Within the inner most loop, i'm trying to exit the script on a fault condition. instead of exiting, it's acting as a 'break 2' and then continuing on with the... (4 Replies)
Discussion started by: gsatch
4 Replies

Featured Tech Videos