I have create one custom_cron.php file in root director. But I want to run file after click on Run cron button from admin site.


What you'd need to do is use hook_cron() https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_cron/7.x

And then use wget or curl or something similar to call your file directly. But that seems quite pointless and you might as will move all the php code from your custom file and put it in your hook_cron() function

Alternatively you could use crontab on linux to set your own regular cron run to your file. But by dooing "run cron" from within drupal would have no effect for you file

|improve this answer|||||

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.