sub _read_pid {
my ($self) = @_;
- my $exe_dir = SL::System::Process->exe_dir;
- my $pid_file_name = join '.', splitdir($exe_dir), 'config.lx_office.conf.pid';
- my $pid_file_path = catfile(catdir($exe_dir, 'users', 'pid'), $pid_file_name);
+ my $exe_dir = SL::System::Process->exe_dir;
- return undef unless -f $pid_file_path;
- return join('', read_file($pid_file_path)) * 1;
+ 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);
+
+ return join('', read_file($pid_file_path)) * 1 if -f $pid_file_path;
+ }
}
sub _run_script_command {
use Data::Dumper;
use DateTime;
use English qw(-no_match_vars);
+use List::Util qw(first);
use POSIX qw(setuid setgid);
use SL::Auth;
use SL::DB::BackgroundJob;
mkdir($pidbase) if !-d $pidbase;
-my $file = -f "${cwd}/config/lx_office.conf" ? "${cwd}/config/lx_office.conf" : "${cwd}/config/lx_office.conf.default";
+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}/",