How do I execute a function every 3 months? What's the proper way to execute a function every 3 months? Watchdog variables don't seem to be available after a certain time. I could create another table to insert the execute function date to compare, but it doesn't seem to be the best approach.

The functionality of such functions are:


Send an eMail
Tag an inactive user
watchdog() is not appropriate place for storage; the $variables parameter is for formatting the display of variable data (e.g. the USERNAME in "User USERNAME has logged in"), not for long term storage of application data.

Instead, use a combination of hook_cron() and the persistent variable functions (variable_get() and variable_set()) to execute a cron task that remembers when it was last run.

/**
 * Implements hook_cron().
 */
function MYMODULE_cron() {

  // Look up last time MYMODULE_function() was run compared to 3 months ago.
  if (variable_get('MYMODULE_function_last_run', 0) &lt;= strtotime('-3 month')) {
     // Run my function
     MYMODULE_function();

     //Store the time when MYMODULE_function() was last run.
     variable_set('MYMODULE_function_last_run', time());
  }
}