I would like to have the ability to prevent cron from running based on a variable set in the database. I have created a hook_cron implementation in a module with an extremely low weight so it will presumably run before all other module's cron hooks. Within that function I then check the variable and call exit() to abort PHP's execution. This seems to work but is there a more elegant way to prevent cron from continuing? Calling exit() seems a bit harsh and I am concerned about unintended consequences. Example code below.
function ex1_cron() {
if (variable_get('ex1_var', 1) === 1) {
watchdog('ex1', 'Cron is being aborted.', array(), WATCHDOG_WARNING, NULL);
exit();
}
}