kostya / eye

Process monitoring tool. Inspired from Bluepill and God.
MIT License
1.19k stars 89 forks source link

starting JVM application with JAVA_OPTS fails #197

Closed ksilin closed 7 years ago

ksilin commented 7 years ago

start_command "JAVA_OPTS=\"-Xmx8G $JAVA_OPTS\" main/target/universal/stage/bin/export-main -- -x 4"

expected behavior: command runs with specified JAVA_OPTS & providede params

the same start command works as expected with god

current behavior:

> eye start 'export'`
> command :start sent to [export]

however, the process does not run:

> eye i 
> export ...unmonitored (unmonitor by flapping at ...)

the log explains the reason

ERROR -- execution failed with #<Errno::ENOENT: No such file or directory - JAVA_OPTS=-Xmx8G $JAVA_OPTS>
ERROR -- process <> failed to start ("#<Errno::ENOENT: No such file or directory - JAVA_OPTS=-Xmx8G $JAVA_OPTS>")

Can I prevent eye from splitting the command before running it and/or not assuming the assuming the first whitesppace-delimited chunk is the command to run?

kostya commented 7 years ago

start command could not include env variables, use env. something like this:

env "JAVA_OPTS" => "-Xmx8G #{ENV["JAVA_OPTS"]}"
start_command "main/target/universal/stage/bin/export-main -- -x 4"
demonize true

https://github.com/kostya/eye/wiki/About-start_command https://github.com/kostya/eye/wiki/Using-ENV-variables-in-config

ksilin commented 7 years ago

Wonderful! Many thanks, now I have got it working perfectly.

Just one more thing I am wondering about. If the demonize flag is not set to true, the application status remains at starting, although it is running and the app will be restarted again and again after a while. Is there an explanation of the behavior I might have missed somewhere?

kostya commented 7 years ago

when daemonize false, your app should create pid file which eye trying to find, if it not created eye couldnot monitor it. in daemonize true, eye daemonize process and create pid_file for it.

ksilin commented 7 years ago

got it, thanks again!