grav icon indicating copy to clipboard operation
grav copied to clipboard

Scheduler not working

Open Ribero opened this issue 3 years ago • 20 comments

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

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 ?

Ribero avatar Jan 16 '21 18:01 Ribero

Do you have environment specific configuration (especially for localhost)?

stephan-strate avatar Jan 18 '21 08:01 stephan-strate

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 ?

Ribero avatar Jan 19 '21 16:01 Ribero

I cannot replicate this with a standard installation, so I'm thinking it's specific to the Docker configuration.

rhukster avatar Jan 20 '21 00:01 rhukster

Probably, I opened an issue for that on the github for the image.

Ribero avatar Jan 20 '21 06:01 Ribero

This could be related to the broken plugin (with missing files) discovered in #3158.

mahagr avatar Jan 20 '21 08:01 mahagr

I do not think as a fresh install from docker image misses the contrab conf. I had to add it manually.

Ribero avatar Jan 20 '21 19:01 Ribero

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 ?

Ribero avatar Jan 21 '21 09:01 Ribero

@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

Ribero avatar Jan 21 '21 16:01 Ribero

I'm afraid not, i've just not had time yet I'm afraid.

rhukster avatar Jan 21 '21 19:01 rhukster

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.

Ribero avatar Jan 25 '21 20:01 Ribero

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 avatar Mar 09 '21 21:03 Batnik

@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 avatar Mar 09 '21 21:03 rhukster

@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

Batnik avatar Mar 09 '21 22:03 Batnik

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

Batnik avatar Mar 09 '21 22:03 Batnik

maybe something was wrong in this update:

screen 2021-03-09 um 23 22 08

Batnik avatar Mar 09 '21 22:03 Batnik

@mahagr can you take a look at this?

rhukster avatar Mar 09 '21 22:03 rhukster

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.

mahagr avatar Mar 10 '21 12:03 mahagr

that was the first thing we saw in documentation, and no it's 100% not the reason.

Batnik avatar Mar 10 '21 15:03 Batnik

We face the exact same problem: Grav 1.7.10

stryba avatar Apr 09 '21 15:04 stryba

Same issue encountered for us 😕

aricooperdavis avatar Apr 08 '22 13:04 aricooperdavis