choxsword
choxsword

Reputation: 3359

why nohup doesn't work in such circumstance?

here is the content of start.sh:

cmd="nohup java -cp lib/*:../common/lib/* -server -Dlogback.configurationFile=cfg/logback.xml -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=30002 simulator4j.SimulateEngine --config cfg/config.pb --properties properties/  &"
$cmd

when I run ./start.sh, it blocked until I input ctrl+c. if I directly input the cmd in terminal, it works well

Upvotes: 0

Views: 366

Answers (1)

Titulum
Titulum

Reputation: 11456

You can execute a string in bash by using the eval command:

cmd="nohup java -cp lib/*:../common/lib/* -server -Dlogback.configurationFile=cfg/logback.xml -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=30002 simulator4j.SimulateEngine --config cfg/config.pb --properties properties/  &"
eval $cmd

Upvotes: 1

Related Questions