3 ms·
OK, total noob question here. Could we achieve the same thing with something like pgrphack from daemontools? pgrphack sh -c "processes" Kill the pid for
by unixnoob 14y ago
OK, total noob question here. Could we achieve the same thing with something like pgrphack from daemontools?
pgrphack sh -c "processes"
Kill the pid for the sh ("agent") and you thereby kill all the processes?
Again, sorry for the noob question. I'm still learning and making mistakes.
- FooBarWidget 14y agoNo. To instruct kill() to kill a process group, you have to specified the PID of the process group leader as a negative number. Otherwise kill() will kill only a single process.
- unixnoob 14y agoBut won't all the processes in my example have the PGID of sh?
- FooBarWidget 14y agoYes they do, but that is irrelevant. kill(pid) kills the process specified by 'pid'. kill(-pid) kills the process group specified by 'pid'.
- unixnoob 14y agoWhat if I just use userland kill(1) utility? Is it possible to kill all processes under a PGID using kill(1)? Say the PGID I get for sh is 321. If I do kill [signal] 321 that will not kill all the processes having PGID 321? If it would not kill them, then couldn't we modify kill(1) to be able to call kill() with a negative integer as you describe? Sorry for the noob questions. I am still learning and making mistakes.
- deleted 14y ago[deleted]