I am not a system engineer (I am a software edeveloper). I have to run a Java application (a runnable .jar file) on a Linux machine (Centos 7). I am connecting to a shell via SSH. This application is in jar format and implement a batch application and containins itself its scheduler.
I have to run it in background on a remote server in order that after that I quit the shell it is still run.
I have performed this command in order to run my application in background:
java -Xms256m -Xmx1024m -jar UpdateInfoBatch-0.0.1-SNAPSHOT.jar &
then I clicked on CTRL+C on my keyboard in order to obtain again the keyboard prompt on my shell.
and here the first trange behavior: I obtain again the shell prompt and the possibility to insert command but if the application log something it is appearing on the shell. Why? I expected that my application still run in background.
Anyway I now prompt this command in the my shell in order to check if my application is running:
[email protected] [~/zzz-import-data-batch]# ps aux | grep java
xxx 23307 15.3 1.6 4871172 418980 pts/0 Sl 10:23 0:22 java -Xms256m -Xmx1024m -jar UpdateInfoBatch-0.0.1-SNAPSHOT.jar
webadmin 23522 0.0 0.0 112812 980 pts/0 S+ 10:25 0:00 grep --color=auto java
And yes my application seems to correctly run (the first one).
Then I close the connection to my shell, I log into it again and I perform again the previous command but now I obtain this:
[email protected] [~/zzz-import-data-batch]# ps aux | grep java
xxx 23919 0.0 0.0 112812 980 pts/0 S+ 10:27 0:00 grep --color=auto java
As you can see after that I disconnect from the shell, when I do a new login my batch application seems that it is not running (and infact my job application doesn't runned).
What is wrong? What am I missing? What could be a good way to run in background my java jar batch application?