1. Crossed fingers, got rid of the instabilities caused by execing programs
[spider.git] / perl / DXCron.pm
index 9e4bde71e9083c5b5c7e9c45a4522c98251ebb3f..3c9c04fb8bb015a7fb37a5c2cc541c55832fdfc5 100644 (file)
@@ -184,9 +184,10 @@ sub start_connect
                if (!$pid) {
                        # in child, unset warnings, disable debugging and general clean up from us
                        $^W = 0;
-#                      do "$main::root/perl/Disable_debug.pl";
                        eval "{ package DB; sub DB {} }";
+                       $SIG{HUP} = 'IGNORE';
                        alarm(0);
+                       DXChannel::closeall();
                        $SIG{CHLD} = $SIG{TERM} = $SIG{INT} = $SIG{__WARN__} = 'DEFAULT';
                        exec $prog, $call, 'connect';
                        dbg('cron', "exec '$prog' failed $!");
@@ -195,6 +196,9 @@ sub start_connect
        } else {
                dbg('cron', "can't fork for $prog $!");
        }
+
+       # coordinate
+       sleep(1);
 }
 
 sub spawn
@@ -206,9 +210,10 @@ sub spawn
                if (!$pid) {
                        # in child, unset warnings, disable debugging and general clean up from us
                        $^W = 0;
-#                      do "$main::root/perl/Disable_debug.pl";
                        eval "{ package DB; sub DB {} }";
+                       $SIG{HUP} = 'IGNORE';
                        alarm(0);
+                       DXChannel::closeall();
                        $SIG{CHLD} = $SIG{TERM} = $SIG{INT} = $SIG{__WARN__} = 'DEFAULT';
                        exec "$line";
                        dbg('cron', "exec '$line' failed $!");
@@ -217,6 +222,9 @@ sub spawn
        } else {
                dbg('cron', "can't fork for $line $!");
        }
+
+       # coordinate
+       sleep(1);
 }
 1;
 __END__