As of v6.0
SwiftMailer dropped support for mail
transport,
so Crunz
v2.0
won't support it either,
please use smtp
or sendmail
transport.
Example of wrong task file:
<?php
return [];
Example of correct task file:
<?php
use Crunz\Schedule;
$scheduler = new Schedule();
$scheduler
->run('php -v')
->description('PHP version')
->everyMinute();
// Crunz\Schedule instance returned
return $scheduler;
If you, for some reason, use above method you should stop it.
This method was intended to be private
and will be in v2.0
,
which will lead to exception if you call it.
Example of wrong usage
<?php
use Crunz\Schedule;
$process = new \Symfony\Component\Process\Process('php -i');
$scheduler = new Schedule();
$task = $scheduler->run('php -v');
$task
// setProcess is deprecated
->setProcess($process)
->description('PHP version')
->everyMinute()
;
return $scheduler;
Searching for Crunz's config is now related to cwd
, not to vendor/bin/crunz
.
For example, if your crunz.yml
is in /var/www/project/crunz.yml
, then run Crunz with cd
first:
cd /var/www/project && vendor/bin/crunz schedule:list
Cron job also should be changed:
* * * * * cd /var/www/project && vendor/bin/crunz schedule:run
Example correct call:
$event = new Crunz\Event;
$event->cron('0 * * * *');
Example config file:
source: tasks
suffix: Tasks.php
timezone: Europe/Warsaw