Reputation: 307
Good afternoon,
I am trying to run this cron to work with queues in laravel 5.6, in a host compared with laravel, but I get the following error:
[root@s19 ~]# /usr/local/bin/php /home/user/myweb/artisan schedule:run
InvalidArgumentException : 5 is not a valid position
at /home/nigmacod/nigmacode/vendor/dragonmantank/cron-expression/src/Cron/FieldFactory.php:46
42| case 4:
43| $this->fields[$position] = new DayOfWeekField();
44| break;
45| default:
> 46| throw new InvalidArgumentException(
47| $position . ' is not a validposition'
48| );
49| }
50| }
Exception trace:
1 Cron\FieldFactory::getField()
/home/user/myweb/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php:153
2 Cron\CronExpression::setPart("*")
/home/user/myweb/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php:136
that is function schedule in my kernel file:
protected function schedule(Schedule $schedule)
{
$schedule->command('queue:work --tries=3')
->cron('* * * * * *')
->withoutOverlapping();
}
And this would be the cron that I have configured in my cpanel so that it runs every minute:
/usr/local/bin/php /home/user/myweb/artisan schedule:run >> /dev/null 2>&1
Upvotes: 2
Views: 2846
Reputation: 180176
->cron('* * * * * *')
is your issue.
Cron expects five values - minute, hour, day of the month, month, and day of the week. You've provided a sixth, and it doesn't know what to do with it.
Change it to ->cron('* * * * *')
(or for better readability, ->everyMinute()
) and you'll be all set.
Upvotes: 11