查找 nohup 命令运行的进程 [英] Find the Process run by nohup command

查看:36
本文介绍了查找 nohup 命令运行的进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下命令在 Centos 中运行服务器可执行文件 "nohup server &".现在我需要终止进程server".但是我尝试了 "ps -a" 命令来获取 PID 但我无法获取该过程.现在怎么杀掉"server"呢?

I run a server executable in Centos using the following command "nohup server &". Now I need to kill the process "server". But I tried "ps -a" command to get the PID but I couldnt get the process. Now how to kill the "server" now?

推荐答案

ps auxwww|grep -i 'server' 应该返回所有包含 server 的进程.否则,服务器可能已经停止.

ps auxwww|grep -i 'server' should return all process which has server in them. Otherwise, server may have already stopped.

您应该能够按如下方式确定 PID(并将其存储在文件中):

You should be able to determine the PID (and store it in a file) as follows:

nohup server &
print $! >> my_server.pid

这篇关于查找 nohup 命令运行的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆