简体   繁体   中英

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. 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.

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:

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

Then we use grep to remove parts we don't want.

And lastly pass the pid to kill.

ps: replace 'root' for the user you know run the service/pid you are looking for.

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