Is it possible to read console input just before the embedded tomcat on the spring boot starts? The supposedly application flow is, request username and password from the user,
If you want to full log with console input like logger + System.out.println() outputs, then you have to use
nohup java -jar yourJarFile.jar admin password >> fullLogOutput.log &
the problem is when I close the console(SSH on linux) the process stops.
So you want to run your jar file as background process. You can't stop it with your console closing. Just add & symbol after full command, it will not stop. You can use the following command.
nohup java -jar yourJarFile.jar &
For taking full log with console output
nohup java -jar yourJarFile.jar >> fullLogOutput.log &
The & symbol is used to run the program in the background.
The nohup utility makes the command passed as an argument run in the background even after you log out.
For stopping the background process, use ps -aux
to get the id and then kill (id number)
ps -aux | grep yourJarFile.jar
You will get the id number. To kill that
sudo kill -9
Resource Link: https://stackoverflow.com/a/12108646/2293534