Jboss Stop Issue

Hello Everybody,

I have recently setup a Jboss-4.2.3 server in a RHEL machine.I copied the "/etc/init.d/jboss" script from another Jboss server and added the same to chkconfig.
When i run - "service jboss start" - the Jboss server starts fine.
However when i run - "service jboss stop" - it reyurns the following error - "No JBossas is currently running".

I debugged the jboss script and found that the script is not able to get the pid of run.sh and hence returning above error.

 
[root@jboss-dev1 init.d]# sh -x /etc/init.d/jboss stop
+ JBOSS_HOME=/usr/local/jboss/jboss-4.2.3.GA
+ JBOSS_USER=hpinadmin
+ JAVAPTH=/usr/local/jdk/jdk1.6.0_18
+ JBOSS_CONF=all
+ JBOSS_BIND_ADDR='-b 16.181.233.224'
+ JBOSSSH='/usr/local/jboss/jboss-4.2.3.GA/bin/run.sh -c all -b 16.181.233.224'
+ '[' hpinadmin = RUNASIS ']'
+ SUBIT='su - hpinadmin -c '
+ '[' -n '' -a '!' -d '' ']'
+ '[' -n '' -a '!' -f '' ']'
+ JBOSS_CONSOLE=/dev/null
+ JBOSS_CMD_START='cd /usr/local/jboss/jboss-4.2.3.GA/bin; /usr/local/jboss/jboss-4.2.3.GA/bin/run.sh -c all -b 16.181.233.224'
++ grep /usr/local/jdk/jdk1.6.0_18
++ echo /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
+ '[' -z '' ']'
+ export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/jdk/jdk1.6.0_18
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/jdk/jdk1.6.0_18
+ '[' '!' -d /usr/local/jboss/jboss-4.2.3.GA ']'
+ case "$1" in
+ stop
+ pid=0
+ procrunning
+ procid=0
++ sed 's/\//\\\//g'
++ awk '{print $1}'
++ echo /usr/local/jboss/jboss-4.2.3.GA/bin/run.sh -c all -b 16.181.233.224
+ JBOSSSCRIPT='\/usr\/local\/jboss\/jboss-4.2.3.GA\/bin\/run.sh'
++ /sbin/pidof -x '\/usr\/local\/jboss\/jboss-4.2.3.GA\/bin\/run.sh'
+ '[' 0 = 0 ']'
+ echo -n -e '\nNo JBossas is currently running\n'
No JBossas is currently running
+ exit 1

I manually ran the pidof command and found it working fine. attached is the output:

 
[root@jboss-dev1 init.d]# /sbin/pidof -x '\/usr\/local\/jboss\/jboss-4.2.3.GA\/bin\/run.sh'
[root@jboss-dev1 init.d]# pidof -x /usr/local/jboss/jboss-4.2.3.GA/bin/run.sh
11847

This is pretty strange and i am not able to make anything out of above.

Any inputs is appreciated.

Thanks
HG

#JBOSSSCRIPT=$(echo $JBOSSSH | awk '{print $1}' | sed 's/\//\\\//g')
JBOSSSCRIPT=$(echo $JBOSSSH | awk '{print $1}')