Process killer is a PHP script that you can run as a cgi to kill a list of process. Better than running "ps -aux", check the pid and then kill it ... this script can help you to automate this task.
Process killer (Unix/linux)
@package
@author Ben Yacoub Hatem <hatem@php.net>
@copyright Copyright (c) 2004
@version $Id$
@access public
$keys = array_keys($commands);
if (!in_array($tokil,$keys )) {
if ($debug) {
echo "No process $tokil to kill.";
}
} else {
foreach($commands[$tokil] as $v){
shell_exec("kill -9 $v");
}
if ($debug) {
echo sizeof($commands[$tokil])." process related to $tokil is killed.";
}
}
}
?>
Jose Santos wrote :1139
It`s very good !!
Kill process is very useful in Linux Operations Systems !!
Joseph Crawford wrote :1148
this is a nice script, i mean it shows people how to use php as a shell script rather than a web script however i would still prefer to do kill -9 <pid> personally
i want to make sure the correct process is killed ;)
also i dont see how it can do much i mean it`s either kill -9 <pid or ./script <process name> not much different.
Ben Yacoub Hatem wrote :1149
the difference in this script is that you can use it if there is many process launched with differents pid ! so in this case u have to kill em one after one ... you see ?
But with this script you can just kill all process with different pid but related to the same app. And you can keep the $debug = true; to be sure that the pid was killed.