Skip to content
Advertisement

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?

Advertisement

Answer

Your oneliner kill: (I know it’s bad, but it should work)

ps -ef| grep "name_of_service" | grep -oP "roots+(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.

Advertisement