Bug 1273093

Summary: [GSS](6.4.z) EAP zip based init scripts doesn't detach jbossas process
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Tom Fonteyne <tfonteyn>
Component: Scripts and CommandsAssignee: Bartek Spyrko-Smietanko <bspyrkos>
Status: CLOSED CURRENTRELEASE QA Contact: Marek Kopecky <mkopecky>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4.4CC: bmaxwell, bspyrkos, cdewolf, fnasser, ihradek, jbilek, msochure, pgier, pkremens, rstancel
Target Milestone: CR1   
Target Release: EAP 6.4.13   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
RHEL
Last Closed: 2017-02-03 16:43:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1386335, 1425754    

Description Tom Fonteyne 2015-10-19 14:37:50 UTC
The zip based install of EAP ships with:

  bin/init.d/jboss-as-domain.sh
  bin/init.d/jboss-as-standalone.sh

which allows them to be run as services on a RHEL and similar *NIX systems.

The scripts use the "/etc/init.d/functions" library which bring "daemon" to start programs. In our case to start the domain/standalone.sh scripts.

The intention is that these start in the background, but this fails.

Reproduce:
- create a new OS user "jbossadm"
- unzip EAP in his home directory
- copy bin/init.d/jboss-as.conf to /etc/jboss-as/
  configure it with:
     JBOSS_HOME=/home/jbossadm/jboss-eap-6.4
     JBOSS_USER=jbossas
     JBOSS_CONSOLE_LOG=/home/jbossadm/console.log

- copy bin/init/jboss-as-domain.sh  to /etc/init.d
- become su, and start with:
     /etc/init.d/jboss-as-domain.sh start

-run:   ps axfo pid,ppid,user,command | grep jboss

 2328     1 root     /bin/sh /etc/init.d/jboss-as-domain.sh start
 2332  2328 root      \_ runuser -s /bin/bash jbossadm -c ulimit -S -c 0 >/dev/null 2>&1 ; LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=/var/run/jboss-as/jboss-as-domain.pid /opt/jboss/current/bin/domain.sh --domain-config=domain.xml --host-config=host.xml
 2333  2332 jbossadm      \_ bash -c ulimit -S -c 0 >/dev/null 2>&1 ; LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=/var/run/jboss-as/jboss-as-domain.pid /opt/jboss/current/bin/domain.sh --domain-config=domain.xml --host-config=host.xml
 2334  2333 jbossadm          \_ /bin/sh /opt/jboss/current/bin/domain.sh --domain-config=domain.xml --host-config=host.xml
 2422  2334 jbossadm              \_ /opt/java/current/bin/java -D[Process Controller] -server -Xms64m -Xmx512m […]

Expectation: "domain.sh" to become detached and have "1" as its parent.

ISSUE: line 94 is currently:

daemon --user $JBOSS_USER LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=$JBOSS_PIDFILE $JBOSS_SCRIPT --domain-config=$JBOSS_DOMAIN_CONFIG --host-config=$JBOSS_HOST_CONFIG 2>&1 >$JBOSS_CONSOLE_LOG &

FIX: should be:

daemon --user $JBOSS_USER LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=$JBOSS_PIDFILE "$JBOSS_SCRIPT --domain-config=$JBOSS_DOMAIN_CONFIG --host-config=$JBOSS_HOST_CONFIG &" 2>&1 >$JBOSS_CONSOLE_LOG

e.g. the "&" needs to be bundled with the actual script -> so add quotes and move the & insude the quotes.

The same is true for the "bin/init.djboss-as-standalone.sh" script:

line 90 should become:

daemon --user $JBOSS_USER LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=$JBOSS_PIDFILE "$JBOSS_SCRIPT -c $JBOSS_CONFIG &" > $JBOSS_CONSOLE_LOG 2>&1


Also: the same remark is valid for lines 96 respectively line 94 where "su" is used instead of "daemon" if "/etc/init.d/functions" is not available

Comment 4 Mike McCune 2016-03-28 22:21:53 UTC
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions

Comment 6 JBoss JIRA Server 2016-06-14 11:38:10 UTC
Jiri Pallich <jpallich> updated the status of jira JBEAP-3666 to Closed

Comment 7 Ivo Hradek 2017-01-03 09:50:54 UTC
Verified with EAP 6.4.13.CP.CR1;

Comment 8 Petr Penicka 2017-02-03 16:43:18 UTC
Released with EAP 6.4.13 on Feb 02 2017.