From 2dffed32b8ca244087eab7d03638ed5766f96042 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 8 Aug 2012 16:30:56 +0200 Subject: [PATCH] =?utf8?q?Task-Server=20mit=20SIGALRM=20sofort=20aufwecken?= =?utf8?q?=20k=C3=B6nnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- scripts/task_server.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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"; + } } } -- 2.20.1