0

I'm making a shell script to kill applications; however I can't kill applications like Xcode that have multiple processes because when I kill the processes already running, new ones appear to take their place, maybe there's a parent process that call the other ones or something, is there a workaround for this?

jonathanwiesel
  • 1,036
  • 2
  • 16
  • 35

2 Answers2

0

ps -o ppid -p <childpid> will report the PPID column (parent PID)

Pipe the result to tail -1 to capture the result:

$ ps -o ppid 12345 | tail -1

a.drew.b
  • 84
  • 2
  • The problem with my particular case is that one of the parents is the launchd process, killing all other processes produce a re-apparition of some of them – jonathanwiesel Sep 10 '12 at 23:46
0

Try killing the whole process group:

 kill -9 -<pid>

Note "-" before pid

dimba
  • 26,717
  • 34
  • 141
  • 196