Reputation: 850
I am using ubuntu 14.04
I am running a jar file which should be collection a large amount of data for a few days.
I am running the jar file thought this command and it works fine.
java -jar xxx.jar
However when i close the putty, the process stopped. Is there a way for a jar file to run even when i close the putty?
Upvotes: 3
Views: 3529
Reputation: 652
I would suggest to you use
nohup java -jar xxx.jar > /dev/null 2>&1 &
which redirects standard error & output of the command to /dev/null which means it's discarded. If you need the console output of this command then you can redirect it to any file as follows
nohup java -jar xxx.jar > output.log 2>&1 &
Upvotes: 1
Reputation: 647
You need the nohup command. This command makes processes keep running despite closing terminal.
Run your jar with (in case you are in the right folder):
nohup java -jar xxx.jar &
Upvotes: 0
Reputation: 1195
You can use nohup to run the jar(any process) in background.
Use the following command in the putty session :
nohup java -jar xxx.jar &
Upvotes: 3