#!/bin/bash JAVA_HOME='/java' PATH="$PATH:/$JAVA_HOME/bin" java -cp ./classes:./lib com.mystuff.bar.foo.myclass &
home='/opt/scripts/jvm' program=jvm.script.sh su scriptuser -c "$home/$program"
/opt/scripts/jvm is symlinked to
/data/shellscripts exists as a real directory).
Running the init script fails with
cannot find class com.mystuff.bar.foo.myclass
but if I su to the same user and run it, it works, why?
When I run
su scriptuser -c 'declare -p JAVA_HOME' I get
JAVA_HOME not found, but if I su to the user first (using
su scriptuser) and run it, I get
This may sound crazy, but it seems to fix the issue if I add a trailing slash to the home variable in the init script.
It almost seems like something environmental is messing with the way the symlinks are being handled.