How to get the process ID to kill a nohup process?

前端 未结 13 1839
醉酒成梦
醉酒成梦 2020-11-27 08:53

I\'m running a nohup process on the server. When I try to kill it my putty console closes instead.

this is how I try to find the process ID:

ps -ef |         


        
相关标签:
13条回答
  • 2020-11-27 09:22

    About losing your putty: often the ps ... | awk/grep/perl/... process gets matched, too! So the old school trick is like this

    ps -ef | grep -i [n]ohup 
    

    That way the regex search doesn't match the regex search process!

    0 讨论(0)
  • 2020-11-27 09:24

    You could try

    kill -9 `pgrep [command name]`
    
    0 讨论(0)
  • 2020-11-27 09:26

    This works for mi fine on mac

    kill -9 `ps -ef | awk '/nohup/{ print \$2 }'`
    
    0 讨论(0)
  • 2020-11-27 09:28

    jobs -l should give you the pid for the list of nohup processes. kill (-9) them gently. ;)

    0 讨论(0)
  • 2020-11-27 09:29

    This works in Ubuntu

    Type this to find out the PID

    ps aux | grep java
    

    All the running process regarding to java will be shown

    In my case is

    johnjoe      3315  9.1  4.0 1465240 335728 ?      Sl   09:42   3:19 java -jar batch.jar
    

    Now kill it kill -9 3315

    The zombie process finally stopped.

    0 讨论(0)
  • 2020-11-27 09:29

    when you create a job in nohup it will tell you the process ID !

    nohup sh test.sh &
    

    the output will show you the process ID like

    25013
    

    you can kill it then :

    kill 25013
    
    0 讨论(0)
提交回复
热议问题