Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. WordPress (Developer)
  3. Cron tasks

Cron tasks

Scheduled Pinned Locked Moved Solved WordPress (Developer)
35 Posts 3 Posters 3.1k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mdreiraM Offline
      mdreiraM Offline
      mdreira
      translator
      wrote on last edited by
      #1

      Hi!

      I have an image optimization plugin in Wordpress (dev) that needs wp-cron to work. It's not working with Cloudron's default settings. I don´t know why.

      Is it possible that I have to call wp-cron every so often to get it to work? (2 times a day for example)
      How should I do it from the Cron tab of the application?

      Screenshot: https://prnt.sc/26q7kaa

      Thank you.

      girishG 1 Reply Last reply
      0
      • mdreiraM mdreira

        Hi!

        I have an image optimization plugin in Wordpress (dev) that needs wp-cron to work. It's not working with Cloudron's default settings. I don´t know why.

        Is it possible that I have to call wp-cron every so often to get it to work? (2 times a day for example)
        How should I do it from the Cron tab of the application?

        Screenshot: https://prnt.sc/26q7kaa

        Thank you.

        girishG Offline
        girishG Offline
        girish
        Staff
        wrote on last edited by
        #2

        @mdreira wp-cron is automatically configured and you don't have to run/configure things manually. The cron section is only meant for any additional cron tasks that you want to run which are (often) unrelated to the app. You can manually run /app/pkg/cron.sh via the Web Terminal and check if the cron tasks are running or not. Can you please try?

        BTW, feel free to post those images inline here. Those links often lead me to some captcha links and hard to get the context for future readers.

        mdreiraM 1 Reply Last reply
        0
        • girishG girish moved this topic from Support on
        • girishG girish

          @mdreira wp-cron is automatically configured and you don't have to run/configure things manually. The cron section is only meant for any additional cron tasks that you want to run which are (often) unrelated to the app. You can manually run /app/pkg/cron.sh via the Web Terminal and check if the cron tasks are running or not. Can you please try?

          BTW, feel free to post those images inline here. Those links often lead me to some captcha links and hard to get the context for future readers.

          mdreiraM Offline
          mdreiraM Offline
          mdreira
          translator
          wrote on last edited by
          #3

          @girish Screeshot: https://prnt.sc/26qbnex

          girishG 1 Reply Last reply
          0
          • mdreiraM mdreira

            @girish Screeshot: https://prnt.sc/26qbnex

            girishG Offline
            girishG Offline
            girish
            Staff
            wrote on last edited by
            #4

            @mdreira right, that means that the app has no scheduled events. Is the plugin scheduling any event? Not a WP expert, but you also check with various cron commands like this:

            sudo -u www-data -i -- /app/pkg/wp --path=/app/data/public/ cron
            

            See https://developer.wordpress.org/cli/commands/cron/ for subcommands. For example, https://developer.wordpress.org/cli/commands/cron/event/

            1 Reply Last reply
            1
            • girishG Offline
              girishG Offline
              girish
              Staff
              wrote on last edited by
              #5

              So, I think the command below will list the cron events and schedules. So, if the plugin scheduled it, it will appear below.

              sudo -u www-data -i -- /app/pkg/wp --path=/app/data/public/ cron event list
              
              mdreiraM d19dotcaD 3 Replies Last reply
              1
              • girishG girish

                So, I think the command below will list the cron events and schedules. So, if the plugin scheduled it, it will appear below.

                sudo -u www-data -i -- /app/pkg/wp --path=/app/data/public/ cron event list
                
                mdreiraM Offline
                mdreiraM Offline
                mdreira
                translator
                wrote on last edited by
                #6

                @girish It seems to me that the plugin task does not appear in the list.

                I'm going to discuss this with the plugin folks. I'll tell you something when they answer me.

                Thank you!

                1 Reply Last reply
                0
                • girishG girish

                  So, I think the command below will list the cron events and schedules. So, if the plugin scheduled it, it will appear below.

                  sudo -u www-data -i -- /app/pkg/wp --path=/app/data/public/ cron event list
                  
                  mdreiraM Offline
                  mdreiraM Offline
                  mdreira
                  translator
                  wrote on last edited by mdreira
                  #7

                  @girish Yes, the task was on the list.

                  The plugin people ask me what is the code with which Cloudron starts wp-cron to see if it is compatible.

                  EDIT: I have seen the error. Screenshot: https://prnt.sc/26qc3mk

                  1 Reply Last reply
                  0
                  • girishG girish

                    So, I think the command below will list the cron events and schedules. So, if the plugin scheduled it, it will appear below.

                    sudo -u www-data -i -- /app/pkg/wp --path=/app/data/public/ cron event list
                    
                    d19dotcaD Offline
                    d19dotcaD Offline
                    d19dotca
                    wrote on last edited by d19dotca
                    #8

                    @girish Side note but FWIW, it may be worth updating/clarifying the documentation here: https://docs.cloudron.io/apps/wordpress-developer/#cron-tasks

                    The doc saying "The app is configured to run WordPress cron tasks every minute." seems a bit conflicted with the statement later that reads "WordPress' built-in cron task schedule wp-cron is disabled since it is not effective for low traffic websites."

                    I believe we're running our own cron tasks in Cloudron which manually invokes the WP-Cron every minute instead of the default behaviour of WP running it itself only when the website is visited, correct?

                    --
                    Dustin Dauncey
                    www.d19.ca

                    girishG 1 Reply Last reply
                    0
                    • d19dotcaD d19dotca

                      @girish Side note but FWIW, it may be worth updating/clarifying the documentation here: https://docs.cloudron.io/apps/wordpress-developer/#cron-tasks

                      The doc saying "The app is configured to run WordPress cron tasks every minute." seems a bit conflicted with the statement later that reads "WordPress' built-in cron task schedule wp-cron is disabled since it is not effective for low traffic websites."

                      I believe we're running our own cron tasks in Cloudron which manually invokes the WP-Cron every minute instead of the default behaviour of WP running it itself only when the website is visited, correct?

                      girishG Offline
                      girishG Offline
                      girish
                      Staff
                      wrote on last edited by
                      #9

                      @d19dotca Right... wp-cron with the hyphen refers to the file wp-cron.php which is this PHP code that runs WP cron jobs via apache. Of course, PHP code only runs if someone visits the web site. So, if no one visits your site for an hour, cron jobs are not run. So, on Cloudron (and most other WP hosts), we set up an external scheduler/timer to run the cron jobs.

                      I guess what is being said is The app is configured to run WordPress' cron tasks every minute without using the built-in wp-cron

                      mdreiraM 1 Reply Last reply
                      1
                      • girishG girish

                        @d19dotca Right... wp-cron with the hyphen refers to the file wp-cron.php which is this PHP code that runs WP cron jobs via apache. Of course, PHP code only runs if someone visits the web site. So, if no one visits your site for an hour, cron jobs are not run. So, on Cloudron (and most other WP hosts), we set up an external scheduler/timer to run the cron jobs.

                        I guess what is being said is The app is configured to run WordPress' cron tasks every minute without using the built-in wp-cron

                        mdreiraM Offline
                        mdreiraM Offline
                        mdreira
                        translator
                        wrote on last edited by mdreira
                        #10

                        @girish have you seen anything in error log? https://prnt.sc/26qc3mk

                        EDIT: The plugin guys tell us that the problem is the way we call to wp-cron.

                        So even though Cloudron calls wp-cron every minute, I would like to call it twice a day more with the typical type of call from the cron tab. Something like:

                        0 */12 * * * /usr/bin/php -q /public/wp-cron.php >/dev/null 2

                        This is the type of call that the plugin needs. It's possible?

                        We are interested in this image optimization plugin because it optimizes images in the cloud without a limit of megabytes. I have to try to make it work.

                        If you know of another plugin that does the same and works on cloudron, we can switch.

                        girishG 1 Reply Last reply
                        0
                        • mdreiraM mdreira

                          @girish have you seen anything in error log? https://prnt.sc/26qc3mk

                          EDIT: The plugin guys tell us that the problem is the way we call to wp-cron.

                          So even though Cloudron calls wp-cron every minute, I would like to call it twice a day more with the typical type of call from the cron tab. Something like:

                          0 */12 * * * /usr/bin/php -q /public/wp-cron.php >/dev/null 2

                          This is the type of call that the plugin needs. It's possible?

                          We are interested in this image optimization plugin because it optimizes images in the cloud without a limit of megabytes. I have to try to make it work.

                          If you know of another plugin that does the same and works on cloudron, we can switch.

                          girishG Offline
                          girishG Offline
                          girish
                          Staff
                          wrote on last edited by girish
                          #11

                          @mdreira We use WP CLI to run cron jobs like so:

                          sudo -u www-data -i -- /app/pkg/wp --skip-themes --path=/app/data/public/ cron event run --due-now
                          

                          Are you able to run the command above manually and see if it produces the error message ? Also, remove the --skip-themes and check if that helps as well, maybe that's causing the problem. TBH, I am not 100% sure why we have --skip-themes there, it should probably be removed.

                          mdreiraM 1 Reply Last reply
                          0
                          • girishG girish

                            @mdreira We use WP CLI to run cron jobs like so:

                            sudo -u www-data -i -- /app/pkg/wp --skip-themes --path=/app/data/public/ cron event run --due-now
                            

                            Are you able to run the command above manually and see if it produces the error message ? Also, remove the --skip-themes and check if that helps as well, maybe that's causing the problem. TBH, I am not 100% sure why we have --skip-themes there, it should probably be removed.

                            mdreiraM Offline
                            mdreiraM Offline
                            mdreira
                            translator
                            wrote on last edited by mdreira
                            #12

                            @girish Here I send you the screenshot of the terminal after sending those commands:

                            Captura de pantalla 2022-02-09 a las 21.20.31.jpg

                            Running it like this did not make the plugin work.

                            The plugin cron task is this:

                            Captura de pantalla 2022-02-09 a las 21.20.42.jpg

                            When the cron executes this task it gives me this error:

                            Captura de pantalla 2022-02-09 a las 21.20.53.jpg

                            Is there any other way to execute that task? I have to get that plugin working. The plugin people don't know what's going on because our cloudron server is something special 😄

                            girishG 2 Replies Last reply
                            0
                            • mdreiraM mdreira

                              @girish Here I send you the screenshot of the terminal after sending those commands:

                              Captura de pantalla 2022-02-09 a las 21.20.31.jpg

                              Running it like this did not make the plugin work.

                              The plugin cron task is this:

                              Captura de pantalla 2022-02-09 a las 21.20.42.jpg

                              When the cron executes this task it gives me this error:

                              Captura de pantalla 2022-02-09 a las 21.20.53.jpg

                              Is there any other way to execute that task? I have to get that plugin working. The plugin people don't know what's going on because our cloudron server is something special 😄

                              girishG Offline
                              girishG Offline
                              girish
                              Staff
                              wrote on last edited by
                              #13

                              @mdreira please post the images inline in this forum. You can just ctrl+v the screenshot to paste in the forum. I am afraid those images will go away at some point and this post will be meaningless if those images go away....

                              1 Reply Last reply
                              0
                              • mdreiraM mdreira

                                @girish Here I send you the screenshot of the terminal after sending those commands:

                                Captura de pantalla 2022-02-09 a las 21.20.31.jpg

                                Running it like this did not make the plugin work.

                                The plugin cron task is this:

                                Captura de pantalla 2022-02-09 a las 21.20.42.jpg

                                When the cron executes this task it gives me this error:

                                Captura de pantalla 2022-02-09 a las 21.20.53.jpg

                                Is there any other way to execute that task? I have to get that plugin working. The plugin people don't know what's going on because our cloudron server is something special 😄

                                girishG Offline
                                girishG Offline
                                girish
                                Staff
                                wrote on last edited by
                                #14

                                @mdreira Also, can you tell me which plugin this is? From the screenshot it says weimgoptimizer but https://wordpress.org/plugins/search/weimgoptimizer/ is a not found.

                                mdreiraM 1 Reply Last reply
                                0
                                • girishG girish

                                  @mdreira Also, can you tell me which plugin this is? From the screenshot it says weimgoptimizer but https://wordpress.org/plugins/search/weimgoptimizer/ is a not found.

                                  mdreiraM Offline
                                  mdreiraM Offline
                                  mdreira
                                  translator
                                  wrote on last edited by
                                  #15

                                  @girish The plugin is optimizador.io (https://optimizador.io/)

                                  Right now I edit the links of the screenshots and upload the images directly.

                                  girishG 3 Replies Last reply
                                  0
                                  • mdreiraM mdreira

                                    @girish The plugin is optimizador.io (https://optimizador.io/)

                                    Right now I edit the links of the screenshots and upload the images directly.

                                    girishG Offline
                                    girishG Offline
                                    girish
                                    Staff
                                    wrote on last edited by
                                    #16

                                    @mdreira I will give it a try locally to see if I can reproduce the problem.

                                    1 Reply Last reply
                                    0
                                    • girishG Offline
                                      girishG Offline
                                      girish
                                      Staff
                                      wrote on last edited by
                                      #17

                                      Struggling to get this API key. https://optimizador.io/registro-clave-api/ has no form to fill anything, not sure how to proceed.

                                      mdreiraM 1 Reply Last reply
                                      0
                                      • girishG girish

                                        Struggling to get this API key. https://optimizador.io/registro-clave-api/ has no form to fill anything, not sure how to proceed.

                                        mdreiraM Offline
                                        mdreiraM Offline
                                        mdreira
                                        translator
                                        wrote on last edited by mdreira
                                        #18
                                        This post is deleted!
                                        girishG 1 Reply Last reply
                                        0
                                        • mdreiraM mdreira

                                          This post is deleted!

                                          girishG Offline
                                          girishG Offline
                                          girish
                                          Staff
                                          wrote on last edited by
                                          #19

                                          @mdreira apparently, that page doesn't work in firefox. works in chrome.

                                          1 Reply Last reply
                                          1
                                          • girishG Offline
                                            girishG Offline
                                            girish
                                            Staff
                                            wrote on last edited by
                                            #20

                                            You can run the specific hook like this

                                            root@d2c84f40-ba29-47fd-87a5-48c873006e89:/app/code# sudo -u www-data -i -- /app/pkg/wp --skip-themes --path=/app/data/public/ cron event run my_schedule_hook
                                            

                                            I am getting the same exception you posted.

                                            mdreiraM 1 Reply Last reply
                                            2
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes


                                              • Login

                                              • Don't have an account? Register

                                              • Login or register to search.
                                              • First post
                                                Last post
                                              0
                                              • Categories
                                              • Recent
                                              • Tags
                                              • Popular
                                              • Bookmarks
                                              • Search