I am tryin to deploy a java *.jar based software on OOD with “java -jar code.jar -port 64444”, but it seems that the OOD only executes the command with “java -jar code.jar”. May I ask if there is a way to solve this?
There is nothing in OnDemand that would reject arguments within your template/script.sh.erb. Would you mind sharing your script with us so that we can help debug it?
It’s the backslashes without newlines in bash that’s giving you the problem.
#either do multi line with \ seperated
java -jar /opt/apps/h2o-3.26.0.11/h2o.jar \
-port \
"${app_port}"
# or single line without any \s
java -jar /opt/apps/h2o-3.26.0.11/h2o.jar -port "${app_port}"
we tried the single line cmd “java -jar /opt/apps/h2o-3.26.0.11/h2o.jar -port “${app_port}””, which didn’t work, the “-port” can not be imported in OOD.
we set up the enviornment in “before.sh.erb”, which is printed in both “before” and “after” scripts and they are consistent.
“export app_port=(find_port {host})”
OOD templates these shell scripts then submits the main one to the scheduler. At this point, it’s in the scheduler hands (and runtime). Then the environment becomes just Linux/bash. This is where I think the issue is.
If you’re still having problems, to help diagnose the issue, let’s remove OOD from the equation. I would suggest navigating to a directory that this batch job created, looking at the resulting shell scripts, modifying them and resubmitting them by hand (with whatever debug statements you need) to see what’s really going on.
# here's an example one that I have
/users/PZS0714/johrstrom/ondemand/data/sys/dashboard/batch_connect/sys/bc_osc_jupyter/output/feb7fbd3-3792-4f3b-be95-6e8de9502f9f
# here's how that directory may differ
$YOUR_HOME/ondemand/data/sys/dashboard/batch_connect/{sys,dev,usr}/$APP_NAME/output/$SOME_UUID
In this directory you’ll see a job_script_content.sh This was the shell script that was submitted to your scheduler. Look at it to see what the result was and if it’s what you’d expect.
Now you can re-submit this script in this working directory. In moab/torque parlance it’s qsub -d $(pwd) job_script_content.sh. With this, you can play around with the formatting