Tuesday 14 February 2012 3:07:28 pm
In this blog post I will show how to setup a cronjob extension.
Let's create our folder structure inside extension folder first:
Then let's define that this extension has cronjob scripts by creating the mycronjob/settings/cronjob.ini.append.php file:
<?php /* [CronjobSettings] ExtensionDirectories[]=mycronjob # We can also create custom cronjob part here, so we can invoke by php cli and crontabs # We can also add scripts or redefine an existing cronjob part. [CronjobPart-mycronpart] # Scripts[] to redefine an existing cronjob part Scripts[]=mycronscript.php */ ?>
Inside cronjobs folder we create our scripts that we have defined in the conjobpart settings, in this case it will be cronjobs/mycronscript.php :
<?php // code goes here ?>
To invoke your cronjob you need to use php cli:
php runcronjobs.php mycronpart