• I have been trying to create a cron job, but I am stoked and need help.

    I need to run th following script one per 24 hours:
    http:domain.com/wp-cron.php?import_key=Iq_GCn7v0&import_id=36&action=trigger

    the following one to run after the above, once or twice.
    http:domain.com/wp-cron.php?import_key=Iq_GCn7v0&import_id=36&action=processing

    I created both cron under AMC dashboard and added the following hooks in my functions php file:

    if( !wp_next_scheduled( 'myjobs_trigger' ) ) {
       wp_schedule_event( time(), 'daily', 'myjobs_trigger' );
    }
    add_action( 'myjobs_trigger', 'update_myjob_trigger' );
    function update_myjob_trigger() {
       // do whatever you want
    wp_remote_get('http:domain.com/wp-cron.php?import_key=Iq_GCn7v0&import_id=36&action=trigger');
    }//end
    //Run the execution script Once every 30 minutes
    if( !wp_next_scheduled( 'myjobs_process' ) ) {
       wp_schedule_event( time(), '60*30', 'myjobs_trigger' );
    }
    add_action( 'myjobs_process', 'update_myjob_process' );
    function update_myjob_process	() {
       // do whatever you want
    wp_remote_get('http:domain.com/wp-cron.php?import_key=Iq_GCn7v0&import_id=36&action=processing');
    }//end

    I’m missing a lot here.
    First I can’t properly figure out how to write a function that first test the trigger cron has run before running the processing second.
    I couldn’t also properly write the timing for the processing cron which timing should be 2 times daily after the trigger cron ran.

    Any help will be appreciated.

    https://www.ads-software.com/plugins/advanced-cron-manager/

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘I need a sample cron job creation’ is closed to new replies.