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


SOLVED Create a custom cron



  • 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?



  • I have exactly the same situation and question!


  • App Dev

    @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



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


  • Staff

    @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.