My cronjob is defined as follows:
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job instance="Vendor\Module\Model\Status" method="update" name="vendor_module_status_update">
<schedule>0 */2 * * *</schedule>
</job>
</group>
</config>
Class Vendor\Module\Model\Status
exists and manual test below works fine:
<?php
declare(strict_types=1);
use Magento\Framework\App\Bootstrap;
use Magento\Framework\App\Http as Http;
use Magento\Framework\AppInterface as AppInterface;
require '/path/to/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
class TestApp extends Http implements AppInterface
{
public function launch()
{
$update = $this->_objectManager->get(Vendor\Module\Model\Status::class);
$update->update();
echo get_class($update);
return $this->_response;
}
public function catchException(Bootstrap $bootstrap, Exception $exception): bool
{
return false;
}
}
/** @var Http $app */
$app = $bootstrap->createApplication('TestApp');
$bootstrap->run($app);
However for some reason execution via cronjob throws:
Class Vendor\Module\Model\Status does not exist
Any idea what could be a reason?