swatch exec で指定して他のプログラム実行させると、子プロセスがdefunct になってゾンビで生き続けてうざいので、Swatch::Actions のsub exec_command 内に local $SIG{CHLD} = 'IGNORE'; を足した
件名の通りで、内容は1つ前のエントリとほぼ同じ。
# diff -u /usr/lib/perl5/vendor_perl/5.8.8/Swatch/Actions.pm.org /usr/lib/perl5/vendor_perl/5.8.8/Swatch/Actions.pm
--- /usr/lib/perl5/vendor_perl/5.8.8/Swatch/Actions.pm.org 2013-03-06 14:07:51.000000000 +0900
+++ /usr/lib/perl5/vendor_perl/5.8.8/Swatch/Actions.pm 2013-03-06 14:08:07.000000000 +0900
@@ -94,6 +94,8 @@
and $args{'THRESHOLDING'} eq 'on'
and not &Swatch::Threshold::threshold(%args));
+ local $SIG{CHLD} = 'IGNORE';
+
EXECFORK: {
if ($exec_pid = fork) {
waitpid(-1, WNOHANG);
03/28 追記
$SIG{CHLD} 設定しても1プロセスだけゾンビになるしこれもうざかったのでてっとり早く解決するためにforkしているところをやめて、systemコマンド実行するだけに変えた。
--- /usr/share/perl5/vendor_perl/Swatch/Actions.pm.org 2013-03-29 14:48:59.503029794 +0900
+++ /usr/share/perl5/vendor_perl/Swatch/Actions.pm 2013-03-29 14:49:20.620031971 +0900
@@ -94,22 +94,7 @@
and $args{'THRESHOLDING'} eq 'on'
and not &Swatch::Threshold::threshold(%args));
- EXECFORK: {
- if ($exec_pid = fork) {
- waitpid(-1, WNOHANG);
- return 0;
- } elsif (defined $exec_pid) {
- exec($command);
- } elsif ($! =~ /No more processes/) {
- # EAGAIN, supposedly recoverable fork error
- sleep 5;
- redo EXECFORK;
- } else {
- warn "$0: Can't fork to exec $command: $!\n";
- return 1;
- }
- }
- return 0;
+ return not system $command;
}
################################################################