jboss-init.sh script gets wrong values for PROFILE_HOME and JBOSS_HOME vars
rafaeltuelho opened this issue · 1 comments
rafaeltuelho commented
After create a symlink for jboss-init.sh script in /etc/init.d you can execute it using the symlink: eg.
# /etc/init.d/jboss start
In that case the script gets wrong paths for PROFILE_HOME and JBOSS_HOME.
See the execution on Bash debug mode (-x):
[jboss@jbosssrv jboss-eap-6.2]$ bash -x /etc/init.d/jboss-dsv
+ BIND_ADDRESS=172.16.3.97
++ dirname /etc/init.d/jboss-dsv
+ DIR=/etc/init.d
+ DOMAIN_PROFILE=/opt/jboss/jboss-eap-6.2
+ DOMAIN_PROFILE=jboss-eap-6.2
+ [[ linux-gnu == *linux* ]]
++ readlink -f /etc/init.d/../
+ PROFILE_HOME=/etc/rc.d
++ readlink -f /etc/init.d/../../
+ JBOSS_HOME=/etc
+ . /etc/bin/init.d/jboss-custom.sh
/etc/init.d/jboss-dsv: line 50: /etc/bin/init.d/jboss-custom.sh: No such file or directory
I fix this issue with this little patch:
- create a new env var PROGRAM to get the path of the script
- based on PROGRAM get the real script directory path and set to DIR.
PROGRAM=$( readlink -f $0 )
DIR=$( dirname $PROGRAM )
Now you can use the symlink to issue comands on jboss-init.sh.
hodrigohamalho commented
On line 20 jboss-init.sh:
. ../../bin/init.d/jboss-custom.sh $*
it must be relative.