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


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Solved Create a custom cron

    WordPress (Developer)
    cron clear cache wp rocket
    4
    5
    359
    Loading More Posts
    • 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.
    • V
      Vladimir last edited by

      Hello! I have been using Cloudron for over a month now and I am very happy with it. Recently I have installed the WP Rocket caching plugin and I have to make a cron task that clears the cache and triggers the preload. WP Rockets suggests to make a php file (my-file-name.php) in the Wordpress directory with this content:

      <?php 
      // Load WordPress.
      require( 'wp-load.php' );
      
      // Clear cache.
      if ( function_exists( 'rocket_clean_domain' ) ) {
      	rocket_clean_domain();
      }
      
      // Preload cache.
      if ( function_exists( 'run_rocket_sitemap_preload' ) ) {
      	run_rocket_sitemap_preload();
      }
      

      And make this cron job:

      wget -q -O - http://yourdomain.com/my-file-name.php?doing_wp_cron >/dev/null 2>&1
      

      I read that Cloudron should have /app/data/crontab cron file but I could't find it. I am trying to run this cron task every day at 12:15 and 16:15.

      Can you help me with this issue?

      1 Reply Last reply Reply Quote 1
      • imc67
        imc67 translator last edited by

        I have exactly the same situation and question!

        murgero 1 Reply Last reply Reply Quote 0
        • murgero
          murgero App Dev @imc67 last edited by

          @imc67 If the file doesn't exist - just make it. But that said, I do not believe the unmanaged app has cron, which is a shame

          --
          https://urgero.org
          ~ Professional Nerd. Freelance Programmer. ~
          Matrix: @murgero:urgero.org

          1 Reply Last reply Reply Quote 0
          • V
            Vladimir last edited by

            Just a fast update. I found a workaround with WP CRONTROL plugin, where I can add the PHP and make the cron.

            1 Reply Last reply Reply Quote 0
            • girish
              girish Staff last edited by

              @Vladimir Indeed. This solution is documented in the Managed WP docs and not in the unmanaged one - https://cloudron.io/documentation/apps/wordpress/#cron-tasks . I will fix it up.

              1 Reply Last reply Reply Quote 1
              • First post
                Last post
              Powered by NodeBB