Schedule/Cron Jobs 6th Parameter Can anyone tell me what the 6th parameter is used for, in the time expression?
Example: Illuminate\Console\Scheduling\Event
public function hourly()
{
$this->expression = '0 * * * * *';
return $this;
}
It is my understanding that cron only take 5 time parameters.
I believe that's processed by the CronExpression class which has six constants: minute, hour, day, month, weekday, year. Cron uses minute, hour, day, month, weekday. The addition of the year for the yearly() method seems to be the reason for the extra *.
Based on Cron Expression documentation https://github.com/mtdowling/cron-expression , the sixth parameter is optional year.
* * * * * *
- - - - - -
| | | | | |
| | | | | + 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)
Ok, what threw me off, was the ability to run an annual task with the following:
0 0 1 1 *
So, this then allows to run a task every 5 or 10 years? Though, I can't see how that would be applicable.
This cron will run at 2015, 2020 and 2025
0 0 1 1 0 2015,2020,2025
To make it runs every 5 years
0 0 1 1 0 */5
Please sign in or create an account to participate in this conversation.