Custom function doesn't get triggered by hook_cron() I have set up some FeedImporters and I've linked some custom batch imports to these FeedImporters. But for some reason, the function isn't triggered when running the cron... I'm wondering why. Anyone who can help me out on this one?

I've linked some custom functions to be triggered after the import:

/*
 *  Initialize hook_feeds_after_import()
 */
function my_module_feeds_after_import(FeedsSource $source) {
    _my_custom_function();
}

function _my_custom_function() {
    // Define fields
    $fields  = array('field1', 'field2', 'field3');

    // Trigger Batch for import
    batch_set(_start_my_batch('myfile', 'mytable', $fields));
}


And then my custom batch import:

function _start_my_batch($file, $table, $fields) {
    $batch = array(
      'operations'        =&gt; array(
        array('_import_csv_to_database_batch', array($file, $table, $fields)),
      ),
      'finished'          =&gt; '_import_csv_to_database_finish',
      'title'             =&gt; t("Import data in the $table-table"),
      'init_message'      =&gt; t("Feed is starting ($table)."),
      'progress_message'  =&gt; t('Processed @current out of @total.'),
      'error_message'     =&gt; t('Feed has encountered an error.'),
      'file'              =&gt; drupal_get_path('module', 'batch_example') . '/batch_example.inc',
    );

    batch_set($batch);
}


the _import_csv_to_database_batch is a custom batch import by the book. But for some reason, when I run following cron function, the _my_custom_function() isn't even triggered... 

function my_module_cron() {
    _my_custom_function();
    watchdog('my_module', 'feed cron');
}


So why is that and how can I configure my cron to trigger this?
Can you change:

function _my_custom_function() {
    // Define fields
    $fields  = array('field1', 'field2', 'field3');
    // Trigger Batch for import
    batch_set(_start_my_batch('myfile', 'mytable', $fields));
}


Into

function _my_custom_function() {
    // Define fields
    $fields  = array('field1', 'field2', 'field3');
    $function = '_start_my_batch';
    $batch = $function('myfile', 'mytable', $fields);
    // Trigger Batch for import
    batch_set($batch);
}


I think you should check every functions separately (hook_cron, batch function..) and make sure they work. After that put on the same place and play. The Example Module also is the very good place for doing this kind of stuff.