From: Moritz Bunkus Date: Wed, 8 Aug 2012 14:30:56 +0000 (+0200) Subject: Task-Server mit SIGALRM sofort aufwecken können X-Git-Tag: release-3.0.0beta1~303 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=2dffed32b8ca244087eab7d03638ed5766f96042;p=kivitendo-erp.git Task-Server mit SIGALRM sofort aufwecken können --- diff --git a/scripts/task_server.pl b/scripts/task_server.pl index 5854a5197..1ac7e3126 100755 --- a/scripts/task_server.pl +++ b/scripts/task_server.pl @@ -123,7 +123,16 @@ sub gd_run { } my $seconds = 60 - (localtime)[0]; - sleep($seconds < 30 ? $seconds + 60 : $seconds); + if (!eval { + local $SIG{'ALRM'} = sub { + $::lxdebug->message(0, "Got woken up by SIGALRM") if $lx_office_conf{task_server}->{debug}; + die "Alarm!\n" + }; + sleep($seconds < 30 ? $seconds + 60 : $seconds); + 1; + }) { + die $@ unless $@ eq "Alarm!\n"; + } } }