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?
Asked
Active
Viewed 384 times
2 Answers
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