[
http://jira.jboss.com/jira/browse/JBAS-3748?page=comments#action_12344909 ]
Ian Springer commented on JBAS-3748:
------------------------------------
I tested the version Dmitris checked in on RHEL4. Once I've set the
LAUNCH_JBOSS_IN_BACKGROUND flag, i.e.:
export LAUNCH_JBOSS_IN_BACKGROUND=1
everything works as designed.
---
Note, I noticed during my testing that JBoss ignores SIGPIPE. So running "kill
-PIPE" on the run.sh process, is a no-op. However, if a "real" SIGPIPE
occurs, JBoss becomes disconnected from its output and so run.sh appears to be hung. To
reproduce this, run:
export LAUNCH_JBOSS_IN_BACKGROUND=1
./run.sh | more
Then, from another terminal, kill the 'more' process. You should see the run.sh
window appear to hang, though JBoss will still be running, with its output going to
/dev/null. Not sure if/how we want to handle this situation; one possiblity would be to
stop the JBoss process if a SIGPIPE occurs, i.e.:
trap "kill -TERM $JBOSS_PID" PIPE
Another possiblity would be to print a warning, i.e.:
trap "WARNING: run.sh has received a SIGPIPE; JBoss output may no longer be
associated with a terminal." PIPE
Allow bin/run.sh to run in the background and stop jboss, when
stopped.
-----------------------------------------------------------------------
Key: JBAS-3748
URL:
http://jira.jboss.com/jira/browse/JBAS-3748
Project: JBoss Application Server
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Affects Versions: JBossAS-4.0.5.CR1
Reporter: John Mazzitelli
Assigned To: Dimitris Andreadis
Fix For: JBossAS-4.0.5.GA
Attachments: patch-pidfile.txt, patch.txt, run.sh.patch
I want to write an init.d script with the typical start - stop options to start JBossAS.
I want to use the method of writing a pid file when started and killing the pid found in
the file when stopping.
I do not want to use the "normal" shutdown mechanism to stop it because that
assumes the JBoss instance has exposed its remote MBean interface (and I do not want to
assume that). Plus, I want to ensure it is killed, and using the "kill" command
is as fool-proof as I need it to be.
I also want to be able to use run.sh to start the instance (I do not want to have to do
all the work run.sh does - setting up the JVM, passing in arguments, worrying about all
the cygwin - darwin things, etc. etc.).
But, if my init.d script starts run.sh, I cannot use $! in my init.d script as the pid
file contents because $! is the pid of run.sh script process. It is NOT the pid of the
JBoss JVM instance itself. If I then go to kill the run.sh process, it dies, but the JVM
process does not. Therefore, the init.d stop option does not work - it cannot stop the
JBoss VM.
I would like to propose to make the following change to run.sh that would facilitate
this. This change is backwards compatible. What this change does is - if I set the
environment variable "LAUNCH_JBOSS_IN_BACKGROUND" and source run.sh, run.sh will
export JBOSS_PID as the pid value of the JVM process. My init.d script (the thing that
sources run.sh) will be able to write JBOSS_PID anywhere I want and thus later be able to
use it to kill the JBoss VM.
See attached patch for the change.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira