date = $date; $this->download = $download; } /** * Execute the job. */ public function handle(): void { $projectFolder = base_path('../'); $command = [ sprintf('%srunpython.sh', $projectFolder), sprintf('--date=%s', $this->date->format('Y-m-d')), sprintf('--days=%d', $this->days), ]; // Convert commands array to a single string $process = new Process($command); $process->setTimeout(3600); // stel een geschikte timeout in $process->start(); try { $process->wait(function ($type, $buffer) use (&$myOutput){ logger($buffer); }); } catch (ProcessFailedException $exception) { logger('error', $exception->getMessage()); } $this->download->update([ 'status' => 'completed', ]); } }