Sunday, January 14, 2018

Customizing cron.php

Customize cron.php without replacing the stock file

I wanted to add functionality where I would be emailed if any of the cron jobs failed for any reason.  I found in $sugar_config there is an option to override the cron class that is used to run scheduled jobs and normal cron related things. You can add it to the config_override.php file like this...



So once you have that set up, just create a file called custom/include/SugarQueue/CustomSugarCronJobs.php like this
The Class name should match the file name, 'CustomSugarCronJobs' in this case. You could override any function, here I override the function jobFailed(), or you could add a function.

2 comments:

  1. Hello Kenneth,

    Could you share the code of the $GLOBALS['developerCommunication'] class and how to put it as $GLOBAL?

    Thank you.

    Regards,

    David.

    ReplyDelete
    Replies
    1. Yes, its kinda crap at the moment, just a global function. Let me turn it into something a little better and I'll release it too. I should be able to do that tonight.

      Delete