The UNIX and Linux Forums  


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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 04-22-2009
julirani julirani is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 14
Unhappy Urgent help required

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 04:47 AM.. Reason: added code tags