试图调度工匠命令如何找到/路径/到/ artisan?
https://laravel.com/docs/5.0/artisan
* * * * * php /path/to/artisan schedule:run 1>> /dev/null 2>&1
是否有人可以告诉我我怎么知道/path/to/artisan
?
试图调度工匠命令如何找到/路径/到/ artisan?
https://laravel.com/docs/5.0/artisan
* * * * * php /path/to/artisan schedule:run 1>> /dev/null 2>&1
是否有人可以告诉我我怎么知道/path/to/artisan
?
artisan
是在你的Laravel项目的根。所以,如果你的项目路径看起来像/home/laravel-proj/
使用本:
* * * * * php /home/laravel-proj/artisan schedule:run 1>> /dev/null 2>&1
Artisan位于您的项目目录中。例如,我的crontab显示是这样的:
* * * * * /usr/bin/php /var/www/projectfolder/artisan command
扩展由@Alexy Mezenin给出的答案,让在Ubuntu当前工作目录使用PWD命令。
for Windows用户可能CD
所以,如果你在桌面/博客有一个项目。 转到博客目录并运行pwd
命令,你会得到工匠是/家庭/用户/桌面/博客的路径
然后你会使用这个:
* * * * * php /home/user/Desktop/blog/artisan schedule:run 1>> /dev/null 2>&1
在Linux系统上: 使用终端>转到项目文件夹 - >运行pwd
。您应该获得的路径是项目的绝对路径。
在Windows上,我认为你需要运行cd
什么是'2>&1'? – ihue
请在这里阅读说明:http://unix.stackexchange.com/questions/163352/what-does-dev-null-21-mean-in-this-article-of-crontab-basics –
感谢分享.. 。 惊人 ... – ihue