-
Notifications
You must be signed in to change notification settings - Fork 1
Cronjobs
xolf edited this page Mar 21, 2017
·
4 revisions
Dreamcoil gives you the option to run your own Cronjob system.
For this you just need to use the Cron
class.
$cron = new \Dreamcoil\Cron();
$cron->addJob([
'command' => 'php ' . __DIR__ . '/eventSystem.php',
'time' => '* * * * *'
]);
$cron->addJob([
'command' => 'echo Hello',
'time' => '* * * * *'
]);
For the time the following structure were used.
* * * * * *
- - - - - -
| | | | | |
| | | | | + year [optional]
| | | | +----- day of week (0 - 7) (Sunday=0 or 7)
| | | +---------- month (1 - 12)
| | +--------------- day of month (1 - 31)
| +-------------------- hour (0 - 23)
+------------------------- min (0 - 59)
* * * * *
Runs every minute
*/5 * * * *
Runs every 5 minutes
30 12 */4 * *
Runs every 4 day of month on 12:30
You add a job to the Cronjob system.
The $job
have to contain a command
and a time
.
This should look something like:
$cron->addJob([
'command' => 'php ' . __DIR__ . '/eventSystem.php',
'time' => '30 12 * * 5'
]);
This command just runs the Cronjob system.