Bash Script, Kill proccess by pulling from PID file
This is what I have right now in the bash script:
ps aux | grep glassfish | grep domain1 | gawk '{print $2}' | xargs kill -9 The problem with this is that if someone else is logged in and pulling something related to glassfish, it wil pull that PID as well. Thus resulting in killing the wrong PID. So My question is how do I fix what I have to only pull the correct PID, and how do I rewrite it to pull the PID from the PID file that glassfish generates. Thank you for your time. Josh |
Quote:
|
Not a silly question.....
this was pasted from old code....... The ps a (removing the "only yourself") has since been removed. |
Quote:
|
If your distribution supports it, you might find the killall command solves your problem somewhat more easily.
<edit> Here's a bit of the man killall output Code:
|
All times are GMT -5. The time now is 03:01 PM. |