Pimcore Maintenance Task: Set interval

Hey there,

currently I have a Maintenance Task like this:

<?php
namespace AppBundle\Maintenance;

use Pimcore\Maintenance\TaskInterface;
use AppBundle\Service\CertificateDatabaseService;

class UpdateCertificateDatabase implements TaskInterface {

    public function execute() {
       MyService::updateData();
    }
}

Now I have realized that the execute() function is called every five minutes (as this is how often the cronjob is running). I can think of some simple workarounds but what is the intended way to run a cronjob like “twice daily”?

Hi @Blackbam,

You could create a separate Symfony Command and run that command as cron job twice daily.
https://pimcore.com/docs/6.x/Development_Documentation/Development_Tools_and_Details/Console_CLI.html

Hope this helps!

1 Like