]> wagnertech.de Git - mfinanz.git/blobdiff - scripts/task_server.pl
Schreibfehler in Parametername
[mfinanz.git] / scripts / task_server.pl
index 66e81e7c8ea31bc0a5fbdb12aa89ad4dd0ab2ee1..f438b7410f6b12cd74b77f8dd00e6e4df8d6abfd 100755 (executable)
@@ -40,10 +40,9 @@ sub lxinit {
 
   $::lxdebug = LXDebug->new;
   $::locale  = Locale->new($::lx_office_conf{system}->{language});
-  $::cgi     = CGI->new qw();
   $::form    = Form->new;
   $::auth    = SL::Auth->new;
-  $::request = { };
+  $::request = { cgi => CGI->new({}) };
 
   die 'cannot reach auth db'               unless $::auth->session_tables_present;
 
@@ -51,7 +50,7 @@ sub lxinit {
 
   require "bin/mozilla/common.pl";
 
-  die "cannot find user $login"            unless %::myconfig = $::auth->read_user($login);
+  die "cannot find user $login"            unless %::myconfig = $::auth->read_user(login => $login);
   die "cannot find locale for user $login" unless $::locale   = Locale->new('de');
 }
 
@@ -124,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";
+    }
   }
 }
 
@@ -135,7 +143,7 @@ mkdir($pidbase) if !-d $pidbase;
 
 my $file = -f "${cwd}/config/lx_office.conf" ? "${cwd}/config/lx_office.conf" : "${cwd}/config/lx_office.conf.default";
 newdaemon(configfile => $file,
-          progname   => 'lx-office-task-server',
+          progname   => 'kivitendo-task-server',
           pidbase    => "${pidbase}/",
           );