Scenario:
- Running .postinstall.tomcat
$ sudo ./.postinstall.tomcat ... BORING STUFF ... ----------------------------------------------------------------------- NOTICE ----------------------------------------------------------------------- JAVA_HOME environment variable is not set. Either set the JAVA_HOME or edit the configuration scripts inside `/opt/jbcs2/jws-3.1/etc/sysconfig' directory and set the JAVA_HOME to the installed JDK location. Done
- As I run postinstall with sudo and sudo don't have JAVA_HOME set, I get a notice about my empty JAVA_HOME variable.
- Current user has correctly set JAVA_HOME
$ echo $JAVA_HOME /java/installation/location/jdk1.7.0_last
- However running
// $JWS_HOME/sbin $ sudo ./tomcat8 start Oracle Corporation SunOS 5.11 11.3 November 2016 Using CATALINA_BASE: /opt/jbcs2/jws-3.1/share/tomcat8 Using CATALINA_HOME: /opt/jbcs2/jws-3.1/share/tomcat8 Using CATALINA_TMPDIR: /var/cache/tomcat8/temp Using JRE_HOME: /usr Using CLASSPATH: /opt/jbcs2/jws-3.1/share/tomcat8/bin/bootstrap.jar:/opt/jbcs2/jws-3.1/share/tomcat8/bin/tomcat-juli.jar Using CATALINA_PID: /var/run/tomcat8.pid
Gives
Using JRE_HOME: /usr
- And my set JAVA_HOME is not used and output may be unexpected
Issue:
Script $JWS_HOME/sbin/tomcat<VERSION> starts tomcat under user tomcat with it's own
enviroment so your set variables will not be used.
Issue fix:
File $JWS_HOME/sbin/tomcat<VERSION>
66 --- $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT $XCMD $ARGS" 66 +++ $SU $TOMCAT_USER -c "$TOMCAT_SCRIPT $XCMD $ARGS"
SU variable may be "/sbin/runuser" or "su". I haven't tried "/sbin/runuser". However,
su without dash will create expected output. There is need to try runuser script if he is ok with such change.