project = $project; $this->date = $date; $this->offset = $offset; } /** * Execute the job. */ public function handle(): void { $command = [ sprintf('%supdate_RDS.sh', base_path('../')), sprintf('--end_date=%s', $this->date->format('Y-m-d')), sprintf('--offset=%d', $this->offset), sprintf('--project_dir=%s', $this->project->download_path), ]; $process = new Process($command); $process->setTimeout(600); $process->run(); if (!$process->isSuccessful()) { logger('error', [$process->getErrorOutput()]); return; } logger($process->getOutput()); } /** * Handle the job for a date range */ public static function fromDate(Project $project,Carbon $date,int $offset = 1):NullJob|ProjectDownloadRDSJob { $filename = $date->format('Y-m-d') . '.tif'; if (!$project->downloads()->statusSuccess()->where(['name' => $filename])->exists()) { Log::warning("The download $filename can't be processed. Please check it's status."); return new NullJob(); } return new self($project,$date,$offset); } }