![]() |
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 |
| Urgent : Help required | V3l0 | AIX | 2 | 01-11-2008 11:37 AM |
| Urgent help required | umanglalani | Shell Programming and Scripting | 1 | 04-12-2007 03:24 AM |
| Urgent Help required | rahul26 | UNIX for Dummies Questions & Answers | 1 | 08-16-2006 01:23 PM |
| Urgent help required with uname() | rm1 | High Level Programming | 2 | 02-23-2005 10:18 PM |
| C programming - Urgent help required | kkumar1975 | High Level Programming | 2 | 04-08-2002 07:36 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi All,
I am new to unix , Please help me regarding the below issue . my application's main pragram in "a.sh" and one upstream application sending a file daily via connect direct and then calling the script "a.sh" . But the condition in our apll. is no two thread can't run at a time. so there is a validation in "a.sh" but some times it showing the error "one thread running" but when i checked with ps-ef command..then it not satisfying the below condition . Below is the code : Code:
PROCESS=`ps -ef | grep "/appl/a.sh" | grep -v "grep" | wc -l` if [ $PROCESS -gt 2 ] then echo " ERROR:- One thread is running " exit 1 fi Please help me . Thanks in advance Last edited by DukeNuke2; 04-22-2009 at 03:47 AM.. Reason: added code tags |
|
||||
|
Julirani,
I am not sure of the application process, but there is a possibility that there will be multiple instances of a.sh running , but the time u manually check it , the execution of script might be over. Check in the remaining part of the script any infinite loops or conditions exist?.. |
|
||||
|
Quote:
HI Panyam, Thanks for your reply . Actually , it is strange , when i doing the grep using the below command command: ps -ef | grep "/appl/a.sh" | grep -v "grep" output : user 20169 20168 0 06:00:13 ? /bin/ksh /appl/a.sh user 20168 1 0 06:00:13 ? 0:00 sh -c /appl/a.sh But when i print the value of the var for the below command it showing diffrent . command: PROCESS=`ps -ef | grep "/appl/a.sh" | grep -v "grep" | wc -l` echo $PROCESS output : 4 But the output always not the same .some thimes it showing the correct value i.e 2 . So i am unable to find the root cause . Is it any problem with the OS ? Could you please help me regarding this. Thanks in advance . |
|
||||
|
Hi julirani,
I am sure there will be no problem with the OS. Make sure that only one instance of the script "a.sh" is runnning . Your command returnning value 4 since it might found multiple instances of the same.Of course you may not be the one who is running the script once again . Ther might be others in the server who is running. |
| Sponsored Links | ||
|
|