php - Add Laravel task to cron with parameters -
i want add laravel task cron, use run command line (and runs succesfully)
php artisan cron:hourly --env=staging
translated cron:
/usr/bin/php -q /home/usr/public_html/staging/artisan cron:hourly --env=staging
i assume there problem parameter --env=staging
because got error when cron executed (without parameter can't run task in staging environment):
uncaught exception 'pdoexception' message 'sqlstate[hy000] [1045] access denied user ''@'localhost'
could explain me the right syntax execute laravel task in cron?
update
actually, problem happening if place cron command inside sh script. due unknown reason, script not send "--env=staging" argument, , ends on error described.
the error message suggests environnement ist not set properly. i'm not sure why there problem though.
please see crontab file, reference. works on debian linux installation. note -f
flag, problem.
0 23 * * * /usr/bin/php -q -f /home/usr/demo/public_html/artisan mytask --env=live
on server, php-cli output php-notices , therefor sends me lot of emails. should check php-notices and/or disable them setting error_reporting(e_error);
.
Comments
Post a Comment