The documentation on this plugin is lacking, and I was wondering how to utilize it:

Source: https://github.com/EllisLab/Cron/blob/master/cron/pi.cron.php

Devot-ee: http://devot-ee.com/add-ons/expressionengine-cron

My end goal:

  • To check against the expiration_date on certain entries and notify that a template is about to expire.

The CRON would ideally run only once per day. I have little idea as to how to make it work, but what I've been trying simply to ensure that it's working is a plugin with a function:

public function check() 
    return 'test';

and then call this function in a template by:

{exp:cron minute="*" hour="*" day="*" month="*" plugin="<plugin name>:check"}{/exp:cron}

even something like this:

{exp:cron minute="*" hour="*" day="*" month="*" plugin="<plugin name>:check"}{<plugin name>:check}{/exp:cron}

fails to return the string.

3 Answers 3


I do not believe that the Cron will actually return the value from the plugin called via the plugin parameter.

So you can do either:

{exp:cron minute="*" hour="*" day="*" month="*" plugin="my_custom_plugin:check"}{/exp:cron}

This will run the check method of your my_custom_plugin plugin class every minute (provided the template is loaded by someone).


{exp:cron minute="*" hour="*" day="*" month="*"}{exp:my_custom_plugin:check}{/exp:cron}

This will return the check method of your my_custom_plugin plugin class every minute (provided the template is loaded by someone).

Two main things to remember:

  1. Someone has to actually hit the template for it to run - so it's not 100% accurate (if someone loads the template at point 0, the method will run, but if you get no other visitors for another 2 hours, it won't run again until that visitor hits the template, despite the fact that it's set to run every minute).
  2. If you're using any caching methods surrounding your call to the Cron plugin (either template-level caching, or something like CE Cache) it will mess with the faux cron scheduling.

I recently tinkered with the EE cron add-on and gave up on it; didn't work reliably for me.

Automatee might be worth looking at; it can trigger events on a plugin as you desire, I think.

Alternatively, you could pursue setting up an actual crontab; depending on the server admin tools available in your server environment, it's fairly straight forward.

  • This was what I was begninning to assume as the best route, but I wanted to stick with the EE/plugin route specifically so I could use the CodeIgniter db queries. Jan 14, 2014 at 21:25

As nick says, most reliable is a real crontab on the server that calls a (hidden) template on your site. You can use any plugin, sql-query or calls in that template.

However, your original question includes checking the expiration_date for certain entries. There is a (free) extension and module called Scheduled-trigger. It adds the missing feature of triggering a hook when an entry is about to become live (entry_date reached) or when it expires (expiration date reached).

Scheduled trigger will call the entry_submission hook (or a customised hook) which your own extension can hang onto to do stuff.

I'm not affiliated with the add-on, however i did contribute to it ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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