X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/db7dbf2671f1f6b7bbac2c284308dcd79c427711..f16b77358a0cbedf9681c6ea95bd2a076b8b78a9:/SL/System/TaskServer.pm diff --git a/SL/System/TaskServer.pm b/SL/System/TaskServer.pm index 57d0ba827..e410e7311 100644 --- a/SL/System/TaskServer.pm +++ b/SL/System/TaskServer.pm @@ -10,7 +10,7 @@ use Rose::Object::MakeMethods::Generic ( use File::Slurp; use File::Spec::Functions qw(:ALL); -use File::Temp qw(tempfile); +use File::Temp; use SL::System::Process; @@ -43,6 +43,12 @@ sub start { return $self->_run_script_command('start'); } +sub start_if_not_running { + my ($self) = @_; + + $self->start unless $self->is_running; +} + sub stop { my ($self) = @_; @@ -76,12 +82,13 @@ sub _read_pid { sub _run_script_command { my ($self, $command) = @_; - my ($fh, $file_name) = tempfile(); my $exe = catfile(catdir(SL::System::Process->exe_dir, 'scripts'), 'task_server.pl'); + my $temp_file = File::Temp->new; + my $file_name = $temp_file->filename; - system "${exe} ${command} >> ${file_name} 2>&1"; + $temp_file->close; - $fh->close; + system "${exe} ${command} >> ${file_name} 2>&1"; $self->last_command_output(read_file($file_name));