Create function in functions.php with hook name to execute URL

AS said by Fleuv you can use wp_schedule_event() function to execute your code like this

add_action('my_twfours_action', 'my_twfours_action_fn');
my_twfours_action_fn (){
 //this code will execute every 24 hours
}
wp_schedule_event( time(), 'daily', 'my_twfours_action' ); //adding new cron schedule event

To create your 2 minutes filter and then scheduling a cron jo is like

function my_two_minutes_filter( $schedules ) {
    $schedules['two_minutes'] = array(
        'interval' => 120,
        'display' => __( 'Every 2 minutes' ),
    );
    return $schedules;
}
add_filter( 'cron_schedules', 'my_two_minutes_filter' );

then add action and shedule the event like

add_action('my_twominutes_call', 'my_twominutes_call_fn');
my_twominutes_call_fn(){
 //this code will execute every 2 minutes
}
wp_schedule_event( time(), 'two_minutes', 'my_twominutes_call' ); //adding new cron schedule event

Read more here wp_schedule_event();