vikifor
vikifor

Reputation: 3466

Kill nohup process unix

I am running jar using nohup command

nohup java -jar Test.jar

I can't find PID of the jar I am running. I try with:

ps ax | grep java

but it is not listing, then I tried with

ps -ef | grep nohup

and I got this output

root 8503 7529 0 21:52 pts/0 00:00:00 grep nohup

which of the PIDs is PID of nohup process? The first one 8503 is always diffrent, while the second one is the same.

Upvotes: 0

Views: 1674

Answers (2)

Ariful Haque
Ariful Haque

Reputation: 163

The following command in your terminal may help you out to run the script using nohup and redirect the output in your desired file.

General Syntax

nohup some_command &> nohup_log_file.out &

Example

nohup python script.py &> nohup_log_script.out & 

Upvotes: 0

Panta
Panta

Reputation: 199

Maybe the program test.jar is finished. See output in nohup.out. To avoid to display grep as a process, use the following pattern:

ps -aux | grep 'j[a]va'

or

ps -aux | grep java | grep -v grep

Upvotes: 3

Related Questions