Question - Crontab validation error around upgrades

Hello,

I have run into an issue when patching my prod instance, System health gives a health error which prevents patching, the issue is the yearly cron task.

If I go back I can see it ran successfully in September 2022 however it is still marked as red in system health, To clear this I have tried to run the yearly manually however get the following error.

www-data@ip-172-31-28-127:~/html/eramba/app/upgrade$ cd /var/www/html/eramba/app/upgrade && bin/cake cron job yearly 
Exception: Your request to execute a yearly CRON job is invalid, either it has been processed already or it is still being processed
In [/var/www/html/eramba/app/upgrade/plugins/Cron/src/Command/CronJobCommand.php, line 130]

2023-03-03 12:01:25 error: [Cron\Exception\InvalidCronJobException] Your request to execute a yearly CRON job is invalid, either it has been processed already or it is still being processed in /var/www/html/eramba/app/upgrade/plugins/Cron/src/Command/CronJobCommand.php on line 130
Stack Trace:
- /var/www/html/eramba/app/upgrade/vendor/cakephp/cakephp/src/Console/BaseCommand.php:179
- /var/www/html/eramba/app/upgrade/vendor/cakephp/cakephp/src/Console/CommandRunner.php:334
- /var/www/html/eramba/app/upgrade/vendor/cakephp/cakephp/src/Console/CommandRunner.php:172
- /var/www/html/eramba/app/upgrade/bin/cake.php:12

Looking at the CronJobCommand.php there is a skip-validation feature however I’m not sure if this is the right way to clear this error pre-patch.

What is the best way to clear the yearly cron system health error in this case ?

edit:

App Version

3.15.1

DB Schema Version

20220721185933

Yes try to run it like this:

su -s /bin/bash -c "bin/cake cron job yearly --skip-validation" www-data

1 Like

That did it!

Thanks.

1 Like

I cannot seem to get this to work for me, I am using a docker install on ubuntu server.
I get errors about either bin/cake not found, or if I put the whole path, then intl is not installed, or permissions denied…

Any ideas

Most probably you are not running it as a root user.

I tried as root and as www-data but cannot get it work

You should run it from eramba or cron container
docker exec -it eramba bash
and then
su -s /bin/bash -c "bin/cake cron job yearly" www-data

Thank you! I am new to docker and not familiar with how it works, but this helped a lot!

1 Like