Closed utkarsh-sharma-511 closed 2 years ago
Hi, have you set up the cronjob
as mentioned in https://github.com/elements-at/ProcessManager/blob/master/doc/installationAndUpdates.md ?
This should trigger the execution.
Regards, Christian
Hi Christian, Yes I have added the cron.
Can reproduce this issue as well, with the following example command which generates some thumbnails, no errors appears as far as I can find.
class AssetThumbnailGenerationCommand extends AbstractCommand
{
use ExecutionTrait;
protected function configure()
{
$this->setName('app:assets:generate-thumbnails');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$monitoringItem = $this->initProcessManager(3600);
// Real command has multiple folders and multiple sets of thumbnail configs, this is simplified
$monitoringItem->setTotalSteps(1)->setMessage('Starting process')->save();
$phpPath = (new PhpExecutableFinder())->find() ?? Console::getPhpCli();
$folder = Asset\Folder::getByPath("/");
$arguments = [
$phpPath,
PIMCORE_PROJECT_ROOT . '/bin/console',
'pimcore:thumbnails:image',
"--thumbnails=treePreview,wysiwygEmbed",
"--parent={$folderId}",
"--no-ansi",
"--no-interaction",
];
$output->writeln("{$this->getName()} starting command: " . implode(' ', $arguments));
$monitoringItem->setMessage("Processing {$folder->getFullPath()}")->setCurrentStep(1)->save();
$process = new Process($arguments);
$process->setTimeout(3600);
$process->setWorkingDirectory(PIMCORE_PROJECT_ROOT);
$output->writeln("{$this->getName()} processing {$folder->getFullPath()}");
$resultCode = $process->run();
$process->stop(10, $resultCode);
$monitoringItem->setMessage('Job finished')->setCompleted();
return self::SUCCESS;
}
}
@utkarsh-sharma-511 did you resolve this? What was the solution?
@utkarsh-sharma-511 I have the same issue. Process Manager stuck and do nothing since 5 days now.
I am trying to schedule a command to run from cron but it is not working. Though the next run command time is correct but it is not running at that time and the time is not getting updated. I am able to execute the cpmmand manually. .