1

Is there a recommended practice to invoke Java process between invoking directly vs using shell as entry point?

I understand that shell will add extra file to maintain as downside, but provides flexibility in setting up JVM, e.g. JFR, memory conf, etc.

But any issues of using one over the other, e.g. SIGTERM?

Sandeep Jindal
  • 14,510
  • 18
  • 83
  • 121
  • Does [What are shell form and exec form?](https://stackoverflow.com/questions/47904974/what-are-shell-form-and-exec-form) answer your question? Are you referring to the two syntaxes of `CMD`, launching the `CMD` from an entrypoint wrapper script, something else? – David Maze Apr 03 '23 at 10:00

1 Answers1

0

As per the best practices is concerned there is no such recommendation for invoking java Processes.

As both approaches have their own pros and cons. it certainly depends on what your app does or is there any reconfiguration is required in such cases writing a shell makes sense.

An interesting read on this scenario How can I make the dotnet command the second command in docker?

Regarding SIGTERM scenario. The only difference will be if you invoke the java process directly Sigterm will be received by the Java process and in the case of the Shell program your shell PID will receive the shutdown event.

So to conclude I think usage depends on your requirements. Hope this helps.

Suchandra T
  • 569
  • 4
  • 8