1

I have content in an RSS feed that I'm looking to import into separate nodes. I set up a feed importer, and when I run manually, all works as designed (content is imported, fields mapped properly, etc.).

That said, I need to be able to import from the RSS feed on a regular basis. Unfortunately, Elysia Cron won't work, as I don't have access to the crontab on the server. Can this be done programmatically, and on a regular basis?

Thanks!

0

Use

Ultimate Cron

The Ultimate Cron handling for Drupal. Runs cron jobs individually in parallel using configurable rules, pool management and load balancing.

It lives up to its name.

0

There is an option in feed import module settings (admin/config/services/feed_import/settings), where you can set to import your RSS when the cron runs ("Cron import" checkbox).

If you do not have access to crontab, you cannot schedule cron from server side, but if you set cron interval at admin/config/system/cron, cron will be also triggered on, when the time elapses and there will be site visitors on your page (cron will be triggered by one of the site visitors).

Source here.

Edit: If you would like to run cron each 5 minutes (or other custom interval), you will need custom module and implement hook_init(), which is executed on every page load, when the module is active. See the example:

function mymodule_init(){
  //get variable content (last cron run time), if not exists, return 0
  $last_cron_run = variable_get('mymodule_cron_run', 0);

  //if it was more than 5min before
  $five_minutes = 5 * 60;
  if($last_cron_run + $five_minutes < time()){
    //run cron
    $result = drupal_cron_run();

    //do with $result what needed

    //set last cron run time to variable
    variable_set('mymodule_cron_run', time());
  }
}
  • Thanks for the reply. I can set this to import when Cron runs, which I can set to run every hour. However, I'm looking to import this more frequently than that. Ideally, the RSS feed is imported every 5 mins -- so would be looking for something that could execute when the site is visited... – cbcorbett Feb 8 '16 at 18:50
  • i have updated the answer, please check, if that suits your needs. – Juraj Nemec Feb 8 '16 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.