Created a plugin for cron job in wordpress but how to connect it with linux without anyone visiting the site

I have worked on creating a plugin for setting a cron job. However it runs only when a person visits it. Can we link it with linux so that it opens the site and the cron job is done without anyone visiting the page. How can we use wget for this if the wordpress is set up locally?

Related posts

2 comments

  1. Do this following steps to get your server cron going, enable server cron from plugin is not possible as of now (as i understand).

    1. Disable wp-cron.php

    You can disable WP-cron by modifying the wp-config.php (located in the folder where WordPress is installed). Open the wp-config.php file, add a new line after

    define('DISABLE_WP_CRON', true);
    
    1. Set Up a Linux Cron

    Warning: It is important that you familiarize yourself with how cron
    jobs work. You need to have a working knowledge of Linux commands
    before you can use cron jobs effectively.

    To set up a Linux cron job:

    Log into your cPanel.

    In the Advanced section, click Cron jobs.

    Under Add New Cron Job, select the time interval. HostGator recommends that you do not set the interval lower than 15 minutes.

    Set the cron command to the following, replacing yourwebsite.com with your actual domain name:

    wget -q -O - http://yourwebsite.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
    

    The above command tells the Linux server to run wp-cron via wget, which will trigger the wp-cron.php script to do it’s job on your schedule instead of on each page view.
    Click Add New Cron Job to set the cron.

    In order to test out the new cron, simply wait for the elapsed time period for the cron to run. In the event that the cron does not run, please review the steps listed above to ensure that you have completed all steps correctly.

    CREDITS:
    http://support.hostgator.com/articles/specialized-help/technical/wordpress/how-to-replace-wordpress-cron-with-a-real-cron-job

Comments are closed.