Closed keepchen closed 6 years ago
- php /path/to/artisan schedule:run >> /dev/null 2>&1
Start by redirected to a file you can actually look at, there may be output indicating the problem, like so: * * * * * php /path/to/artisan schedule:run >> /tmp/debug_insecure.log 2>&1
You can also try:
php
, it may not be in crontab users shell environment, i.g. /usr/bin/php
/path/to/artisan
without the php
in front, if execute permissions and paths are properly set.@mfn Thanks.
I use an absolute path /usr/bin/php
and redirect to a file /tmp/debug_task.log
.
tailf /tmp/debug_task.log
and this is log below:
Running scheduled command: '/usr/bin/php7.0' 'artisan' send_verify_code >> '/var/disk/log/sms_log/sms_2018-09-05.log' 2>&1
Running scheduled command: '/usr/bin/php7.0' 'artisan' register_push_user >> '/var/disk/log/message/register_user_2018-09-05.log' 2>&1
Running scheduled command: '/usr/bin/php7.0' 'artisan' sync_info >> '/var/disk/log/live/sync_info_2018-09-05.log' 2>&1
None Task be called actually
Can you issue the command yourself using sudo -u www-data -- /usr/bin/php7.0 artisan ...
? It does sound like a permission issue.
@sisve Thank you for your advice. I also thought about whether it is really a permission issue, so I tried to start it manually with the same user rights, the task can be executed normally.
sudo -u www-data php /path/to/artisan schedule:run
It is strange to put it in the crontab, so I am confused.
Hi there,
Welcome to Laravel and we are glad to have you as part of the community.
Unfortunately this GitHub area is not a support area for general application issues. This is only for issues/bugs with the framework code itself.
I will be closing your ticket here. Instead please try asking your question on one of the many great community support areas that will likely give you a better answer more quickly:
If you feel I've closed this issue in error, please provide more information about how this is a framework issue, and I'll reopen the ticket.
Thanks in advance.
Description:
When I use crontab to run laravel task schedule (as default user: root),everything works fine. However,When I specific www-data user as
and configure task command
it doesn't work. I try to configure single task schedule such as
It also can be execute.
Steps To Reproduce:
1.open crontab as specific user
crontab -e -u www-data
2.configure task schedule command* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1