0
votes

We created an installer with Install4J. Now I want to run our application using docker and supervisor. Everything runs fine except that when I stop the process with supervisor only the launcher is terminated. The process which is started by the launcher keeps running. I can define what signal is sent to the launcher by supervisor. I tried SIGTERM and SIGINT but still only the launcher is terminated not the application's process. Can the launcher handle that setup or do I have to call our application on my own using java?

2
Does it make any difference if you remove the "trap ..." line from the launcher start script? - Ingo Kegel
I can't find a 'trap' line in the script. Did I mention the launcher was created with Install4J 6.0!? - PaL

2 Answers

0
votes

Try adding

pid = $!
trap 'kill $pid; exit 1' HUP INT QUIT TERM

after the java invocation in the launcher script.

0
votes

Well the launcher script actually blocks at the java invocation. So it's too late for a trap after that. I got it working now but I'm not completely happy with it:

trap 'kill -TERM $child' TERM

exec $INSTALL4J_JAVA_PREFIX "$app_java_home/bin/java" -Dinstall4j.jvmDir="$app_java_home" -Dexe4j.moduleName="$prg_dir/$progname" "-Dinstall4j.launcherId=181" "-Dinstall4j.swt=false" "$vmov_1" "$vmov_2" "$vmov_3" "$vmov_4" "$vmov_5" $INSTALL4J_ADD_VM_PARAMS -classpath "$local_classpath" com.install4j.runtime.launcher.UnixLauncher launch 17e8376b "$prg_dir/../log/error.log" "" GuiStart  "$@"

child=$!
wait $child

exit $?

So I first setup the trap then run the java invocation with exec so it doesn't block and then I wait for java to end for exiting.

Imho it's far from perfect but it works for now.

UPDATE: Now it works properly. I had to define 'exec' as 'INSTALL4J_JAVA_PREFIX':

INSTALL4J_JAVA_PREFIX="exec"

By default an empty string is assign to it. With 'exec' it works as expected.