Update File Once Every 30 Days

First things first, I suppose that your function already works – I did not debug it, but wanted to point you in the right direction of WordPress scheduling of events.

You should use wp-cron for that. It let’s you schedule events, and let them be handled by WordPress.

Please keep in mind that this is not a real cronjob, and depends on your site being called. If you need the file to be updated wether or not visitors are on your site, consider calling wp-cron by a real cronjob.

At first, you need to register the monthly (or in this case 30 days). You can define any interval there, whatever you need, just pass the interval in seconds.

function f711_add_intervals($schedules) {
    $schedules['thirtydays'] = array(
        'interval' => ( 30 * 24 * 60 * 60 ), // time in seconds.
        'display' => __('30 Days')
    );
    return $schedules;
}
add_filter( 'cron_schedules', 'f711_add_intervals'); 

Now you can register a scheduled event, but only after you checked if it isn’t already registered:

// function to register the event
function f711_activation() {

    // check if event is already scheduled
    if ( !wp_next_scheduled( 'f711_thirtydays_event' ) ) {
        // schedule event with the schedule 'thirtydays', calling the action hook
        wp_schedule_event( current_time( 'timestamp', 'thirtydays', 'f711_thirtydays_event' );
    }

}

// define the hook, calling your function
add_action('f711_thirtydays_event', 'update_some_file');

You can look at the schedule using the wp_get_schedule() function, to check if everything works out correctly.