Jump to content

LazyCron for explicit day and time


suntrop
 Share

Recommended Posts

Hi all, I am looking for some feedback on this one …

I am using LazyCron and have configured a real cron to trigger my homepage every 10 minutes (need this for another module).

But I need one module only to be triggreed every saturday at 9 am (for example). The module sends an email to the CMS admins. Of course I only want this to happen once that day. So I made this one …

//$this->sending_day = 6; Saturday
//$this->sending_hour = 9; at 9am

public function init() {
	if(date('N') == $this->sending_hour && date('G') == $this->sending_hour) {
		$this->addHook('LazyCron::everyHour', $this, 'dispatchMail');
	}
}

Is the everyHour() trustworthy? What happens when the cache got deleted or isn't writeable?

Or do you think there is a better way of handling this?

(Note: Day and time must be configurable from the CMS. I can't call the module from a file that gets triggered by a real cron, because the CMS admins don't have access to the cron jobs on their server)

Thanks :-)

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...