X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Ftask_server.pl;h=8c17ca70a6de97e4ada01f0250681b05459f618e;hb=1186097844e5884cb11cf3d8b724156e329a0f00;hp=1931b6a864e4472aa02c1d76cbea0467723987fc;hpb=de0f9532013c861dae78aa01b9633284d1ceee7c;p=kivitendo-erp.git diff --git a/scripts/task_server.pl b/scripts/task_server.pl index 1931b6a86..8c17ca70a 100755 --- a/scripts/task_server.pl +++ b/scripts/task_server.pl @@ -27,6 +27,7 @@ use SL::DB::BackgroundJob; use SL::BackgroundJob::ALL; use SL::Form; use SL::Helper::DateTime; +use SL::InstanceConfiguration; use SL::LXDebug; use SL::LxOfficeConf; use SL::Locale; @@ -38,11 +39,12 @@ sub lxinit { package main; - $::lxdebug = LXDebug->new; - $::locale = Locale->new($::lx_office_conf{system}->{language}); - $::cgi = CGI->new qw(); - $::form = Form->new; - $::auth = SL::Auth->new; + $::lxdebug = LXDebug->new; + $::locale = Locale->new($::lx_office_conf{system}->{language}); + $::form = Form->new; + $::auth = SL::Auth->new; + $::instance_conf = SL::InstanceConfiguration->new; + $::request = { cgi => CGI->new({}) }; die 'cannot reach auth db' unless $::auth->session_tables_present; @@ -50,7 +52,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'); } @@ -123,7 +125,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"; + } } } @@ -134,7 +145,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}/", );