Run a wp_schedule_event Recurrence Every 3 Minutes

By default, wp_schedule_event lets you choose a recurrence interval of ‘hourly’, ‘twicedaily’, or ‘daily’ for WP Cron jobs. Here, I show you how to add a custom recurrence interval of 3 minutes.

You may want to run a WP Cron job every 3 minutes, or so, for testing purposes. To add an interval of 3 minutes to the WP Cron schedules, use this:

function isa_add_every_three_minutes( $schedules ) {

    $schedules['every_three_minutes'] = array(
            'interval'  => 180,
            'display'   => __( 'Every 3 Minutes', 'textdomain' )
    );
     
    return $schedules;
}
add_filter( 'cron_schedules', 'isa_add_every_three_minutes' );

Now, you can use ‘every_three_minutes’ as the recurrence parameter when you use wp_schedule_event:

wp_schedule_event( time(), 'every_three_minutes', 'your_cron_function' );

Scheduled Cron Job in wordpress

if (!wp_next_scheduled('my_task_hook')) {

    wp_schedule_event(time(), 'hourly', 'my_task_hook');


add_action('my_task_hook', 'my_task_function');

function my_task_function() {

    wp_mail('nileshyadav326@gmail.com', 'Automatic email', 'Automatic scheduled email from WordPress.');

}

Resume Extracting .tar.gz File That Terminated Before Finishing

If you are extracting a very large .tar.gz file, the process can be terminated before it finishes. This can sometimes help:

Run the command again, but add the -k flag so that it will skip over any files that have already been extracted.

So if you were extracting sample.tar.gz, like this:

tar -xvzf sample.tar.gz

Then, after it gets terminated before finishing, run this (it has the -k flag):

tar -xvkf sample.tar.gz