Grmbl... as attachments are removed in favour of SF publicity, here once
again, inline:
--- amavisd-nanny.dist 2008-05-19 19:38:48.000000000 +0200
+++ amavisd-nanny 2009-05-07 12:02:28.000000000 +0200
@@ -217,16 +217,16 @@
if ($n == 0 && $! != ESRCH) {
die "Can't check the process $pid: $!";
} elsif ($n == 0) { # ESRCH means there is no such process
- printf("PID %s: %-11s went away %s\n",
+ printf STDERR ("PID %s: %-11s went away %s\n",
$pid, $proc_task_id{$pid} || $proc_state{$pid},
fmt_age($age, $proc_state_bars{$pid}, $idling) );
push(@to_be_removed, $pid);
} elsif ($age <= $ttl) { # all ok
- printf("PID %s: %-11s %s\n",
+ printf STDERR ("PID %s: %-11s %s\n",
$pid, $proc_task_id{$pid} || $proc_state{$pid},
fmt_age($age, $proc_state_bars{$pid}, $idling) );
} else { # send a SIGTERM
- printf("PID %s: %-11s terminated %s\n",
+ printf STDERR ("PID %s: %-11s terminated %s\n",
$pid, $proc_task_id{$pid} || $proc_state{$pid},
fmt_age($age, $proc_state_bars{$pid}, $idling) );
if (kill('TERM',$pid) || $! == ESRCH) { push(@killed,$pid) }
@@ -253,7 +253,7 @@
Time::HiRes::sleep($delay); $delay = 2;
for my $pid (@killed) {
$waittime{$pid}++;
- printf("PID %s: sending SIGKILL in %d s\n", $pid,
30-$waittime{$pid});
+ printf STDERR ("PID %s: sending SIGKILL in %d s\n", $pid,
30-$waittime{$pid});
if ($waittime{$pid} > 30) { # send a SIGKILL
kill('KILL',$pid) or $! == ESRCH or warn "Can't SIGKILL $pid:
$!";
$waittime{$pid} = 0;
@@ -261,13 +261,13 @@
} elsif ($! != ESRCH) { # problem?
warn "Can't check process $pid: $!";
} else { # no longer around
- printf("PID %s: %-11s successfully killed\n", $pid);
+ printf STDERR ("PID %s: %-11s successfully killed\n", $pid);
delete($waittime{$pid});
$pid = undef;
}
}
@killed = grep {defined} @killed;
- printf("Waiting for the process to terminate: %s\n",
+ printf STDERR ("Waiting for the process to terminate: %s\n",
join(', ',@killed)) if @killed;
}
$| = 1;
@@ -280,5 +280,5 @@
$cursor->c_close if defined $cursor; # ignoring status
$db->db_close==0 or die "BDB db_close error: $BerkeleyDB::Error $!";
}
- print STDERR "exited\n";
+ print STDERR "exited\n" if not defined $repeatcount;
}
Thomas Gelf schrieb:
> Hi all, hi Mark!
>
> Amavisd-nanny is a great tool to get a quick overview of amavisd-new's
> current state. Some time ago I've used a modified version, as there as
> been no "-c" switch - now it is even easier to script it. We are for
> example parsing and embedding it's output in a web application allowing
> our support team to see what's currently going on (even if they don't
> use it, as it is always running smoothley ;-)).
>
> As amavisd-nanny is also cleaning up naughty childs I decided to run
> it in a cron job. However, redirecting all STDERR and STDOUT to my
> nirvana is not really what I usually prefer to do. Information about
> failing processes should still be mailed to sysadmin.
>
> Currently there is nothing but "exited" (and SIG failures) to be found
> in STDERR. "exited" should not be there (it would trigger a mail for
> each time called by cron) - other output (currently only sent to STDOUT)
> is however really interesting.
>
> Attached to this post you can find a small patch showing how I would
> like to change amavisd-nanny to "improve" it's bevahiour, making it
> ready to be used out of the box in your crontab, being called as
> follows:
>
> amavisd-nanny -c 1 >/dev/null
>
> That's all, feedback / improvements are welcome.
>
> Best regards,
> Thomas Gelf
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/