The Status API is available to be accessed for fresh instances:
$cronjob->getStatus();
$lastSchedule = $cronjob->getLastSchedule(); // Carbon\Carbon instance with the last schedule time.
if ($lastSchedule->before(now())) {
echo 'This job already ran...';
}
Active Jobs
while (! $job = $cronjob->getActiveJobs()->first()) {
$cronjob->refresh();
sleep(1);
}
// You can get the scheduled Job's pods.
$job->getPods();
You can access the active jobs for any cronjob. The active jobs return an \Illuminate\Support\Collection instance, on which you can chain various methods as described here:
The $job variable is a K8sJob instance class that is already synced with the existing job. Check for the K8sJob instance.