Skip to content

Commit 0ec36e1

Browse files
lsimonskaruturi
authored andcommitted
Fix CLOUDSTACK-7476: always pass along $JAVA_HOME
On a secured environment (selinux w/ env_reset enabled in sudoers), the runuser command that is invoked by the daemon() function does not pass along environment variables, so $JAVA_HOME is empty, and JSVC falls back to its default behavior, which may not find java or may not find the intended java. This fix simply passes $JAVA_HOME explicitly using the -home argument to JSVC. Signed-off-by: Rajani Karuturi <[email protected]>
1 parent 5d389b1 commit 0ec36e1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packaging/centos63/cloud-usage.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ start() {
9696

9797
echo -n "Starting $PROGNAME" "$SHORTNAME"
9898

99-
if daemon --pidfile $PIDFILE $DAEMON -cp "$CLASSPATH" -pidfile "$PIDFILE" -user "$USER" \
99+
if daemon --pidfile $PIDFILE $DAEMON -home "$JAVA_HOME" -cp "$CLASSPATH" -pidfile "$PIDFILE" -user "$USER" \
100100
-errfile $LOGDIR/cloudstack-usage.err -outfile $LOGDIR/cloudstack-usage.out -Dpid=$$ $CLASS
101101
RETVAL=$?
102102
then

packaging/debian/init/cloud-usage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ start() {
102102
exit 1
103103
fi
104104

105-
if start_daemon -p $PIDFILE $DAEMON -cp "$CLASSPATH" -pidfile "$PIDFILE" -outfile SYSLOG -errfile SYSLOG -Dpid=$$ $CLASS
105+
if start_daemon -p $PIDFILE $DAEMON -home "$JAVA_HOME" -cp "$CLASSPATH" -pidfile "$PIDFILE" -outfile SYSLOG -errfile SYSLOG -Dpid=$$ $CLASS
106106
RETVAL=$?
107107
then
108108
rc=0

0 commit comments

Comments
 (0)