简体   繁体   中英

how to run a jar file on the ubuntu 14.04 without stopping when i stopped the putty?

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?

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 &

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 &

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 &

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM