killall - Kill all instances of a process by pattern matching the command-line
use Proc::Killall;
killall('HUP', 'xterm'); # SIGHUP all xterms
killall('KILL', '^netscape$'); # SIGKILL to "netscape"
This module provides one function, , which takes two parameters: a signal name or number (see killall()) and a process pattern. This pattern is matched against the process' command-line as the kill() command would show it (ps is not used internally, instead a package called ps is used).Proc::ProcessTable
searches the process table and sends that signal to all processes which match the pattern. The return value is the number of processes that were succesfully signaled. If any kills failed, the killall variable will be set based on that last one that failed (even if a successful kill happened afterward).$!
Written in 2000 by Aaron Sherman <ajs@ajs.com>
is copyright 2000 by Aaron Sherman, and may be distributed under the same terms as Perl itself.Proc::Killall
is required for Proc::ProcessTable to function.Proc::Killall