How to set cron jobs in Drupal 7?
I have a PHP file that does some task in consistent intervals and I have placed that PHP file inside a custom module folder but function like drupal_set_message() are not available inside that file. How do I include Drupal functions iside this PHP file and how can I set up this php file to be run as a cron job?
You will need to implement the hook_cron() function in your module and execute these tasks there. You can read more about hook_cron() function from the following link:
After this function is implemented, your drupal will automatically execute these tasks during the default cron handling.