简体   繁体   English

停止Linux服务器中的未知进程

[英]Stopping an unknown process in linux server

I have this command in my deployment process.我的部署过程中有这个命令。 But I want this process to stop and then restart while deploying in linux server.但我希望这个过程停止,然后在 linux 服务器中部署时重新启动。 I checked and found that this is simply a JAVA process, and I can't simply kill JAVA as other nimbus and supervisors are running too.我查了一下,发现这只是一个JAVA进程,我不能简单地杀死JAVA,因为其他nimbus和supervisor也在运行。

sudo nohup java -Droute=full -jar /opt/artifacts/project/project.jar --spring.config.location=/etc/project/application_full.properties >/dev/null 2>&1 &

So, how can I stop this process?那么,我怎样才能停止这个过程呢?

Your oneliner kill: (I know it's bad, but it should work)你的单线杀手:(我知道这很糟糕,但它应该有效)

ps -ef| grep "name_of_service" | grep -oP "root\s+(\d+)\s" | grep -oP "\d+" | kill

ps -ef finds the program line: ps -ef 查找程序行:

root      5727     1  0 11:38 ?        00:00:00 grep service

Then we use grep to remove parts we don't want.然后我们使用grep删除我们不想要的部分。

And lastly pass the pid to kill.最后通过pid杀死。

ps: replace 'root' for the user you know run the service/pid you are looking for. ps:将“root”替换为您认识的运行您正在寻找的服务/pid 的用户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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