Cron, on unix at least, allows commands to be scheduled and executed periodically based on a schedule.
In a web application like Known this can be handy for numerous reasons; scheduling a digest email for users for example, or for scheduling posts to appear at a future time.
Elgg had native cron support, but Known does not (yet). So, I wrote a quick plugin…
Introducing the cron scheduler
The plugin provides a /cron/
endpoint, which is called via code in a crontab script. This script makes a GET call to the endpoint, and the plugin then triggers an event accordingly, e.g. cron/daily
for once a day.
The script is protected via a secret code – once you enable and configure the cron plugin, you will be provided with an admin code, which you must add to your script. This provides basic protection from someone triggering the cron tab erroneously.
Anyway, kick it about and let me know what you think!
favorited this.
nice! I use php_sapi_name() to make sure only cron can trigger the correct process in php.
Nice, I hadn’t thought of that. Thanks for the tip!