1
我在我的win8笔记本电脑上运行Homestead,而我的Cron似乎并没有运行。我试图让预定的工作为Laravel工作,但我暂时无法让Cron运行。Cron工作不在Homestead工作
这是我的crontab,只是简单的尝试调试它。
[email protected]:~$ crontab -l
* * * * * date >> /home/vagrant/Code/CRONTRACK.txt
* * * * * /usr/bin/php artisan schedule:run >> /home/vagrant/Code/laravel_cron_output.txt
当使用crontab -e尝试编辑我的crontab时,这看起来是否正确?
[email protected]:~$ crontab -e
143
现在,当我尝试检查我的系统,看看是否cron的跑什么
[email protected]:~$ grep CRON /var/log/syslog
Dec 3 19:41:01 homestead CRON[3628]: (vagrant) CMD (date >> /home/vagrant/Code/CRONTRACK.txt^M)
Dec 3 19:41:01 homestead CRON[3629]: (vagrant) CMD (/usr/bin/php artisan schedule:run >> /home/vagrant/Code/laravel_cron_output.txt^M)
Dec 3 19:41:01 homestead CRON[3627]: (vagrant) MAIL (mailed 1 byte of output; but got status 0x004b, #012)
Dec 3 19:41:01 homestead CRON[3626]: (vagrant) MAIL (mailed 1 byte of output; but got status 0x004b, #012)
Dec 3 19:42:01 homestead CRON[3635]: (vagrant) CMD (date >> /home/vagrant/Code/CRONTRACK.txt^M)
Dec 3 19:42:01 homestead CRON[3636]: (vagrant) CMD (/usr/bin/php artisan schedule:run >> /home/vagrant/Code/laravel_cron_output.txt^M)
Dec 3 19:42:01 homestead CRON[3634]: (vagrant) MAIL (mailed 1 byte of output; but got status 0x004b, #012)
Dec 3 19:42:01 homestead CRON[3633]: (vagrant) MAIL (mailed 1 byte of output; but got status 0x004b, #012)
Dec 3 19:43:01 homestead CRON[3642]: (vagrant) CMD (date >> /home/vagrant/Code/CRONTRACK.txt^M)
Dec 3 19:43:01 homestead CRON[3643]: (vagrant) CMD (/usr/bin/php artisan schedule:run >> /home/vagrant/Code/laravel_cron_output.txt^M)
Dec 3 19:43:01 homestead CRON[3641]: (vagrant) MAIL (mailed 1 byte of output; but got status 0x004b, #012)
Dec 3 19:43:01 homestead CRON[3640]: (vagrant) MAIL (mailed 1 byte of output; but got status 0x004b, #012)
Dec 3 19:44:01 homestead CRON[3649]: (vagrant) CMD (date >> /home/vagrant/Code/CRONTRACK.txt^M)
Dec 3 19:44:01 homestead CRON[3650]: (vagrant) CMD (/usr/bin/php artisan schedule:run >> /home/vagrant/Code/laravel_cron_output.txt^M)
Dec 3 19:44:01 homestead CRON[3648]: (vagrant) MAIL (mailed 1 byte of output; but got status 0x004b, #012)
Dec 3 19:44:01 homestead CRON[3647]: (vagrant) MAIL (mailed 1 byte of output; but got status 0x004b, #012)
Dec 3 19:45:01 homestead CRON[3656]: (vagrant) CMD (date >> /home/vagrant/Code/CRONTRACK.txt^M)
Dec 3 19:45:01 homestead CRON[3657]: (vagrant) CMD (/usr/bin/php artisan schedule:run >> /home/vagrant/Code/laravel_cron_output.txt^M)
Dec 3 19:45:01 homestead CRON[3655]: (vagrant) MAIL (mailed 1 byte of output; but got status 0x004b, #012)
Dec 3 19:45:01 homestead CRON[3654]: (vagrant) MAIL (mailed 1 byte of output; but got status 0x004b, #012)
好像它的工作,但我无法找到我的管道输出到我的txt文件!
[email protected]:~$ cat /home/vagrant/Code/CRONTRACK.txt^M
cat: /home/vagrant/Code/CRONTRACK.txt^M: No such file or directory
[email protected]:~$ cat /home/vagrant/Code/CRONTRACK.txt
cat: /home/vagrant/Code/CRONTRACK.txt: No such file or directory
[email protected]:~$ ll /home/vagrant/Code/
total 82
drwxrwxrwx 1 vagrant vagrant 4096 Dec 3 18:59 ./
drwxr-xr-x 7 vagrant vagrant 4096 Dec 3 19:31 ../
-rwxrwxrwx 1 vagrant vagrant 153 Dec 3 19:24 crontab.txt*
-rwxrwxrwx 1 vagrant vagrant 70449 Oct 15 20:44 memcached-2.2.0.tgz*
drwxrwxrwx 1 vagrant vagrant 4096 Oct 20 19:05 sample/
[email protected]:~$
并运行我直接在终端给cron中的命令工作完全正常!
[email protected]:~$ date >> /home/vagrant/Code/CRONTRACK.txt^M
[email protected]:~$ cat /home/vagrant/Code/CRONTRACK.txt^M
Thu Dec 3 19:53:06 UTC 2015
另外,^ M从哪里来?它不显示在crontab -l中。