grav
grav copied to clipboard
Scheduler not working
I'm using v1.7.0-rc.20 - Admin v1.9.19 from the official docker image. Made no change since install, only switched from 1.6 to test release 1.7 (all done from Admin Panel)
Scheduler seems to be correctly configured:
![image](https://user-images.githubusercontent.com/2266264/104818797-19397a00-582a-11eb-905b-93b2aaab817e.png)
But no scheduled tasks are launching.
I do not have access to command line (only the admin panel) is there a way to check that everything is working ?
Do you have environment specific configuration (especially for localhost)?
Ok additional information: Even if the screenshoot above states that Scheduler is "Installed and Ready" it's not true. The official docker image misses the configuration of the crontab and the status sent to the admin panel is wrong.
After adding the appropriate entry on the container it seems to work as expected. I need to do more tests. May I suggest to update the official docker image to take this configuration into account ?
I cannot replicate this with a standard installation, so I'm thinking it's specific to the Docker configuration.
Probably, I opened an issue for that on the github for the image.
This could be related to the broken plugin (with missing files) discovered in #3158.
I do not think as a fresh install from docker image misses the contrab conf. I had to add it manually.
The status is the following:
- The scheduler should be active when using the official docker : KO
- The status of the scheduler should reflect the fact crontab is correctly setup : KO
- Activate scheduler by manually adding the crontab to the root user: OK
At the end, the scheduler works but not the status and not the fact it should have been activated in the docker image. Could be related to #3119 ?
@rhukster Were you able to reproduce this issue using the official docker image ?
crontab -u www-data -l
* * * * * cd /var/www/html;/usr/local/bin/php bin/grav scheduler 1>> /dev/null 2>&1
I'm afraid not, i've just not had time yet I'm afraid.
Well, after using :
crontab -u www-data -r
Then re-adding the entry for the scheduler in crontab is started to work.
I have done this on the two containers that I use and it worked on both.
the scheduler is not working for us on several installations, we had to comment this lines so it started to work again:
protected function serve(): int
{
//$this->initializePlugins();
$grav = Grav::instance();
$grav['backups']->init();
//$this->initializePages();
//$this->initializeThemes();
/** @var Scheduler $scheduler */
$scheduler = $grav['scheduler'];
$grav->fireEvent('onSchedulerInitialized', new Event(['scheduler' => $scheduler]));
@Batnik what version of Grav are you on? Without those events you won't be able to use the scheduler to do anything related to pugins, pages, themes etc
@rhukster it's the newest version (1.7.7), same situation is on all our installations.
the scheduler, when run from console delivers no errors, no warnings, just no response - enabling debugger also brings nothing.
running on php 7.4.15
after we uncommented the lines above it started to work - but with the next update we will need to uncomment them again
we ended up setting backups using cron directly as this:
0 23 * * * cd /srv/users/grav/apps/grav/public;/opt/sp/php7.4/bin/php bin/grav backup 1>> /dev/null 2>&1
maybe something was wrong in this update:
@mahagr can you take a look at this?
I bet it doesn't work because of the same reason as above -- the scheduler needs to be run with the same user as Grav itself.
that was the first thing we saw in documentation, and no it's 100% not the reason.
We face the exact same problem: Grav 1.7.10
Same issue encountered for us 😕