Revision db7dbf26
Von Moritz Bunkus vor mehr als 12 Jahren hinzugefügt
SL/System/TaskServer.pm | ||
---|---|---|
ERR_PROCESS => -2,
|
||
};
|
||
|
||
use constant PID_BASE => "users/pid";
|
||
|
||
sub status {
|
||
my ($self) = @_;
|
||
|
||
... | ... | |
my $exe_dir = SL::System::Process->exe_dir;
|
||
|
||
foreach my $conf (qw(kivitendo.conf lx_office.conf kivitendo.conf.default)) {
|
||
my $pid_file_name = join '.', splitdir($exe_dir), "config.${conf}.pid";
|
||
my $pid_file_path = catfile(catdir($exe_dir, 'users', 'pid'), $pid_file_name);
|
||
my $pid_file_path = catfile(catdir($exe_dir, splitdir(PID_BASE())), "config.${conf}.pid");
|
||
|
||
return join('', read_file($pid_file_path)) * 1 if -f $pid_file_path;
|
||
}
|
scripts/task_server.pl | ||
---|---|---|
use Data::Dumper;
|
||
use DateTime;
|
||
use English qw(-no_match_vars);
|
||
use File::Spec;
|
||
use List::Util qw(first);
|
||
use POSIX qw(setuid setgid);
|
||
use SL::Auth;
|
||
... | ... | |
use SL::LXDebug;
|
||
use SL::LxOfficeConf;
|
||
use SL::Locale;
|
||
use SL::System::TaskServer;
|
||
|
||
our %lx_office_conf;
|
||
|
||
... | ... | |
}
|
||
}
|
||
|
||
my $cwd = getcwd();
|
||
my $pidbase = "${cwd}/users/pid";
|
||
chdir $exe_dir;
|
||
|
||
mkdir($pidbase) if !-d $pidbase;
|
||
mkdir SL::System::TaskServer::PID_BASE() if !-d SL::System::TaskServer::PID_BASE();
|
||
|
||
my $file = first { -f } ("${exe_dir}/config/kivitendo.conf", "${exe_dir}/config/lx_office.conf", "${exe_dir}/config/kivitendo.conf.default");
|
||
|
||
die "No configuration file found." unless $file;
|
||
|
||
$file = File::Spec->abs2rel(Cwd::abs_path($file), Cwd::abs_path($exe_dir));
|
||
|
||
my $file = first { -f } ("${cwd}/config/kivitendo.conf", "${cwd}/config/lx_office.conf", "${cwd}/config/kivitendo.conf.default");
|
||
newdaemon(configfile => $file,
|
||
progname => 'kivitendo-task-server',
|
||
pidbase => "${pidbase}/",
|
||
pidbase => SL::System::TaskServer::PID_BASE() . '/',
|
||
);
|
||
|
||
1;
|
Auch abrufbar als: Unified diff
Task-Server: PID-File nur aus relativem Konfigurationsdateinamen ableiten