Ok, so I'm trying to execute the following code:
`#{@daemon_path} --name=#{@app_name} --command=#{@java_path} -- -jar #{jetty_jar} #{@war_path} #{random_port}` sleep(10)
Variable Values:
- @daemon_path = path / to / daemon (correct for my system)
- @app_name = foobarbazquux
- @command = path / to / java (also correct for my system)
- jetty_jar = method that returns the path to the user bank that gets off the pier (checked, works)
- @war_path = / path / to / helloworld / war (checked in stand-alone berth container, works)
- random_port = method that returns a random port number between 10000 and 65535 (temporarily changed it to return 8000 or 22 depending on whether I want to start a war or not)
I get this error (tested commands in bash, they work fine):
Invalid arguments: command not specified
usage: daemon [options] [-] [cmd arg ...]
I fixed the above error by putting quotes around the above commands as follows:
"`#{@daemon_path} --name=#{@app_name} --command=#{@java_path} -- -jar #{jetty_jar} #{@war_path} #{random_port}`" "`#{@daemon_path} --running --name=#{@app_name}`"
Ok, so after executing the code, I check the output with $? and pay attention to the return code 0. It should be 1. I ran it in bash and I will get 1. If I manually placed all the correct values ββfor each variable, it works correctly.
Also, if I execute a script, passing all such values:
`./daemon_script_file #{@daemon_path} #{@app_name} #{@java_path} #{jetty_jar} #{@war_path} #{random_port}`
to daemon script file:
#!/bin/bash set -x d_bin=$1 name=$2 cmd=$3 jar=$4 war=$5 port=$6 $d_bin --name=$name --command=$cmd -- -jar $jar $war $port sleep 10 $d_bin --name=$name --running result=$? exit $result
I get the following debug trace output:
+ d_bin=/usr/bin/daemon + name= + cmd= + jar= + war= + port= + /usr/bin/daemon --name= --command= -- -jar + sleep 10 + /usr/bin/daemon --name= --running + result=1 + exit 1 sh: 2: foobarbazquux: not found invalid file (bad magic number): Exec format error
Are there any clues as to why? Am I doing something incredibly stupid here?
as a note, line:
"#{@daemon_path} --name=#{@app_name} --command=#{@java_path} -- -jar #{jetty_jar} #{@war_path} #{random_port}"
permits:
"/usr/bin/daemon --name=foobarbazquux --command=/usr/java/jdk1.7.0_21/bin/java -- -jar /home/nterry/JettyContainer-1.0.b4-jar-with-dependencies.jar /home/nterry/helloworld.war 8080"
What exactly right