脚本运行正常,当从命令行运行但不通过cron [英] script runs fine when run from command line but not via cron

查看:164
本文介绍了脚本运行正常,当从命令行运行但不通过cron的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



但是php脚本似乎没有运行,即使一个cron作业设置为每10分钟运行一次。



如何查看cron作业生成的错误?

解决方案

请记住,cron在不同的工作目录中运行脚本,而不是你可能使用的目录。在命令行上尝试类似以下命令:

  cd / 
./path/to/your/script。 php

如果失败,请正确修改脚本中的所有路径,直到它运行。然后它将在cron中运行。


i have a php script which runs fine when executed by SSHing into my server and running it.

however the php script doesn't seem to run even though a cron job set to run it every 10 minutes.

How do I view errors produced by cron job ?

解决方案

Remember that cron runs your script in a different working directory than what you're probably used to. Try something like the following on the command line:

cd /
./path/to/your/script.php

If it fails, modify all paths in your script correctly until it runs. Then it will run in cron.

这篇关于脚本运行正常,当从命令行运行但不通过cron的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆