Create Custom Cronjobs


#1

Hello,

I would like to parse an external XML (not RSS or Atom) feed and automatically create pages from it.
My question is: how could I integrate this task in form of a cronjob into grav? Is it possible at all?

E.g. I am familiar with cron creation in the magento shop system. Magento has a single entry for cronjobs. It is one file that gets triggered by a cron setup every 5 minutes. Every coded task will then be delegated. Does grav have something similiar?

I figure I will need to create a plugin. But how can I create a “cronable” task inside this plugin?

Thank you.


#2

There’s no built in support for cronjobs in Grav currently. However you can create a CLI command in a plugin that is easily callable via a cronjob. Quite a few plugins already have helper CLI commands. Here’s an example: https://github.com/getgrav/grav-plugin-login/blob/develop/cli/NewUserCommand.php


#3

Could schedule a python script that parses the external XML potentially.