2

I have a rule that sends an email out to subscribers on the 28th of each month. The rule is executed when cron is run, I have cron set to automatically run once a day.

I also use linkchecker, which uses cron to check the links on the site. Right now I have to remember on the 28th of the month not to run cron for the linkchecker, otherwise my subscribers will get multiple emails that day for each time cron was run.

How can I limit the rule to only run once in any specific day, so that I don't have the potential to accidentally run cron manually and spam my subscribers?

  • Any feedback about my answer? Did it help somehow? – Pierre.Vriens Aug 17 '16 at 14:25
1

Have a look at the "Rules Once per Day" module. Here is how it works (as per the comment in issue 2495775, from the module owner):

  • You specify a trigger hour on the administration settings page for this module.
  • The Rule trigger will then run when cron tasks are first run after the start of that hour. The actual run time will depend on your cron task timings.

So this is another way to understand/Read this:

  • The "Event" will only be triggered when a cron job is run.
  • And that event will only be triggered 1 time / day, i.e. "next time cron runs after the trigger hour has passed".

With that, you should be able to adapt your "rule that sends an email" to run ... once a day, on any day, including the 28th of each month.

  • Never heard of this module, until now. – No Sssweat Jul 1 '16 at 13:12
  • @NoSssweat : didn't realise I included "sound" in my answer here, did I? ... long live contributed modules, instead of wasting time on disposable custom code ... (I know, Drupal developers who care about job security will disagree with me on that, but hey, one can't downvote comments, right?) – Pierre.Vriens Jul 1 '16 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.