我正在运行 Digital Ocean 的 Ubuntu 16.10 x64,并在服务器上部署了 php Framework Laravel 5.3.28。
在大多数情况下,一切都正常工作,但是我试图让 crontab 调用 artisan 命令,例如php artisan schedule:run
这样laravel的任务调度器就可以使用了。
我不想下载任何额外的软件包来完成这项工作,因为我觉得实际上没有必要,因为 cron 可以调用(看起来像)任何编码正确的命令。
我正在尝试做的事情:
从内部crontab -e
我正在尝试正确编写 Ubuntu 的正确调用方式php artisan schedule:run
我做了什么:
我目前已经尝试了多种不同的方式来编写此命令,但没有任何效果,如下所示:
#Attempt for cron
SHELL=/bin/bash
#PATH=????? <---Confused if this is even needed
* * * * * php /path/to/artisan scheduled:run 1>> file.log 2>&1
* * * * * /path/to/php artisan scheduled:run 1>> file.log 2>&1
* * * * * /path/to/php artisan scheduled:run >> file.log
* * * * * /path/to/php artisan scheduled:run 1>> file.log
* * * * * /path/to/php artisan schedule:run
* * * * * /path/to/php /path/to/artisan scheduled:run 1>> file.log
我已经使用多种资源来尝试找到答案,但似乎没有任何东西可以解决我的具体问题。
资源:
https://laracasts.com/series/intermediate-laravel/episodes/2?autoplay=true https://laracasts.com/series/intermediate-laravel/episodes/2?autoplay=true
http://laravel.io/forum/03-05-2014-automated-mysql-backups?page=1 http://laravel.io/forum/03-05-2014-automated-mysql-backups?page=1
https://laracasts.com/discuss/channels/laravel/setting-up-larvel-cron https://laracasts.com/discuss/channels/laravel/setting-up-larvel-cron
https://community.centminmod.com/threads/how-to-run-a-cron-job-properly.2287/ https://community.centminmod.com/threads/how-to-run-a-cron-job-properly.2287/
https://laravel.com/docs/5.3/scheduling https://laravel.com/docs/5.3/scheduling
https://laracasts.com/lessons/recurring-tasks-the-laravel-way https://laracasts.com/lessons/recurring-tasks-the-laravel-way
https://laracasts.com/index.php/discuss/channels/laravel/laravel-artisan-commands-trough-cron-tab https://laracasts.com/index.php/discuss/channels/laravel/laravel-artisan-commands-trough-cron-tab
https://deploybot.com/guides/deploy-a-laravel-app-to-digitalocean https://deploybot.com/guides/deploy-a-laravel-app-to-digitalocean
结论:
在这一点上,我陷入了困境。有人可以帮帮我吗?我想做的就是使用 Ubuntu 的 cron 调用 php artisan 命令,但我不知道具体的方法。非常感谢任何和所有的帮助。
提前致谢,
节日快乐!!
开始了。这就是我的样子。 :)
* * * * * php /home/spacemudd/laravel/artisan schedule:run >> /dev/null 2>&1
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)