Reputation: 3293
I am writing a bash-file (.command @OS X) to easily update a program at my remote server (Linux). I am stuck trying to figure out which PID to kill. I have different processes with the same name, which is mono, since they are executed by mono.
Using pgrep mono I get all the PIDs using mono, however, I only want to kill the process that has the command line SCREEN -dmSL steambot mono SteamBot.exe.
How do I know what PID to kill? Atm, my .command file looks like this:
ssh [email protected]
pgrep mono
I am using ssh-keychain to login also.
Upvotes: 2
Views: 1739
Reputation: 4340
like this:
ps -ef | grep '[S]CREEN -dmSL steambot mono SteamBot\.exe' |
awk '{print $2}' | xargs -r kill
Upvotes: 3