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.
 
 
 

21 lines
564 B

#!/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 30 minutes old ?
if ($diff > 1800){
syslog('info', "Killing PID " . $p->pid . "(" . $p->cmndline .
") because it looks like a stalled qpsmtpd process");
$p->kill(9);
}
}
closelog;