You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
560 B

13 years ago
#!/usr/bin/perl
use Sys::Syslog qw( :DEFAULT setlogsock);
use Proc::ProcessTable;
use Proc::ProcessTable::Process;
setlogsock('unix');
openlog($0,'','user');
$t = new Proc::ProcessTable;
foreach $p ( @{$t->table} ){
next unless $p->cmndline =~ m#^/usr/bin/qpsmtpd-forkserver#;
my $diff = time - $p->start;
# Process is more than 1 hour old ?
if ($diff > 3600){
13 years ago
syslog('info', "Killing PID " . $p->pid . "(" . $p->cmndline .
") because it looks like a stalled qpsmtpd process");
$p->kill(9);
}
}
closelog;