Let's say I have a script to start some java stuff
start.sh
myStuff=10.0.0.13
port=11212
servers=(10.0.0.9 10.0.0.10 10.0.0.11 10.0.0.12 10.0.0.14)
T=$1
R=$2
nohup java -jar myJar.jar -l ${myStuff} -p ${port} -t $T -r $R -m "${servers[@]/%/:11212}" &
If I start the script manually
./start.sh 64 1
for example, everything works as it should
now
echo "nohup ./start.sh 64 1" | at now
however, does nothing.
Why?
I've started similar scripts like this before (none that called java, though) and I can't seem to figure out how they differ.
EDIT
well, not quite nothing, the job DOES get scheduled and does disappear from the atq
, but the jar is not started and there is no nohup.out
anywhere.
EDIT 2
note that
echo "nohup ./start.sh 64 1 > help &" | at now
does create a help
file (not a nohup.out
file, though) but it's empty.
EDIT 3
note that changing the start.sh such that the path to the java binary is hardcoded:
nohup /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java -jar myJar.jar -l ${myStuff} -p ${port} -t $T -r $R -m "${servers[@]/%/:11212}" &
doesn't help either.
EDIT 4
echo "nohup java -version > help &" | at now
creates an empty help
file (but no nohup.out
).
Whereas
echo "nohup java -version > help 2>&1 &" | at now
will print
java version "1.7.0_111"
OpenJDK Runtime Environment (IcedTea 2.6.7) (7u111-2.6.7-0ubuntu0.14.04.3)
OpenJDK 64-Bit Server VM (build 24.111-b01, mixed mode)
into the help
file (and not create a nohup.out
file either).
EDIT 5
getting rid of the nohup, i.e.
java -jar myJar.jar ...
and then
echo "./start.sh 64 1" | at now
doesn't change anything.