Revision db7dbf26
Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt
SL/System/TaskServer.pm | ||
---|---|---|
20 | 20 |
ERR_PROCESS => -2, |
21 | 21 |
}; |
22 | 22 |
|
23 |
use constant PID_BASE => "users/pid"; |
|
24 |
|
|
23 | 25 |
sub status { |
24 | 26 |
my ($self) = @_; |
25 | 27 |
|
... | ... | |
65 | 67 |
my $exe_dir = SL::System::Process->exe_dir; |
66 | 68 |
|
67 | 69 |
foreach my $conf (qw(kivitendo.conf lx_office.conf kivitendo.conf.default)) { |
68 |
my $pid_file_name = join '.', splitdir($exe_dir), "config.${conf}.pid"; |
|
69 |
my $pid_file_path = catfile(catdir($exe_dir, 'users', 'pid'), $pid_file_name); |
|
70 |
my $pid_file_path = catfile(catdir($exe_dir, splitdir(PID_BASE())), "config.${conf}.pid"); |
|
70 | 71 |
|
71 | 72 |
return join('', read_file($pid_file_path)) * 1 if -f $pid_file_path; |
72 | 73 |
} |
scripts/task_server.pl | ||
---|---|---|
21 | 21 |
use Data::Dumper; |
22 | 22 |
use DateTime; |
23 | 23 |
use English qw(-no_match_vars); |
24 |
use File::Spec; |
|
24 | 25 |
use List::Util qw(first); |
25 | 26 |
use POSIX qw(setuid setgid); |
26 | 27 |
use SL::Auth; |
... | ... | |
32 | 33 |
use SL::LXDebug; |
33 | 34 |
use SL::LxOfficeConf; |
34 | 35 |
use SL::Locale; |
36 |
use SL::System::TaskServer; |
|
35 | 37 |
|
36 | 38 |
our %lx_office_conf; |
37 | 39 |
|
... | ... | |
141 | 143 |
} |
142 | 144 |
} |
143 | 145 |
|
144 |
my $cwd = getcwd(); |
|
145 |
my $pidbase = "${cwd}/users/pid"; |
|
146 |
chdir $exe_dir; |
|
146 | 147 |
|
147 |
mkdir($pidbase) if !-d $pidbase; |
|
148 |
mkdir SL::System::TaskServer::PID_BASE() if !-d SL::System::TaskServer::PID_BASE(); |
|
149 |
|
|
150 |
my $file = first { -f } ("${exe_dir}/config/kivitendo.conf", "${exe_dir}/config/lx_office.conf", "${exe_dir}/config/kivitendo.conf.default"); |
|
151 |
|
|
152 |
die "No configuration file found." unless $file; |
|
153 |
|
|
154 |
$file = File::Spec->abs2rel(Cwd::abs_path($file), Cwd::abs_path($exe_dir)); |
|
148 | 155 |
|
149 |
my $file = first { -f } ("${cwd}/config/kivitendo.conf", "${cwd}/config/lx_office.conf", "${cwd}/config/kivitendo.conf.default"); |
|
150 | 156 |
newdaemon(configfile => $file, |
151 | 157 |
progname => 'kivitendo-task-server', |
152 |
pidbase => "${pidbase}/",
|
|
158 |
pidbase => SL::System::TaskServer::PID_BASE() . '/',
|
|
153 | 159 |
); |
154 | 160 |
|
155 | 161 |
1; |
Auch abrufbar als: Unified diff
Task-Server: PID-File nur aus relativem Konfigurationsdateinamen ableiten