Voting

: min(four, four)?
(Example: nine)

The Note You're Voting On

regis dot fr dot php dot net at tornad dot net
16 years ago
A little recursive function to kill a process and his childs.
it works fine for me and I don't have find something else to do it.
It's a mix of various scripts I've found.

<?php
function killProcessAndChilds($pid,$signal) {
exec("ps -ef| awk '\$3 == '$pid' { print \$2 }'", $output, $ret);
if(
$ret) return 'you need ps, grep, and awk';
while(list(,
$t) = each($output)) {
if (
$t != $pid ) {
killProcessAndChilds($t,$signal);
}
}
//echo "killing ".$pid."\n";
posix_kill($pid, 9);
}
?>

<< Back to user notes page

To Top