Symfony2命令不适用于cron [英] Symfony2 Command not working with cron

查看:57
本文介绍了Symfony2命令不适用于cron的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该命令在手动调用时有效,但在cron上不起作用.我已使用 symfony2中的Cron Job 进行引用.没用.

the command works when its manually called, but does not when its on cron. I have used Cron Job in symfony2 this for referencing. did not work.

命令是:

55 09 * * * /usr/bin/php /var/www/symfony2/current/app/console mycommand >> /var/www/symfony2/logs/logthis.txt

/current/是从capistrano到当前版本的链接.

the /current/ is a link from capistrano to the current version.

编辑:我想添加到 peter_the_oak 列表.显而易见,但仍然如此.

EDIT: I would like to add to peter_the_oak list. A obvious one but still.

如果不起作用

  • 检查cron状态

  • Check cron status

sudo su
/etc/init.d/cron status

如果返回失败

/etc/init.d/cron start

对我来说就是这样.

推荐答案

有时,如果cron作业不起作用,那是因为以下几点之一:

Sometimes if cron jobs are not working, it's because one of these points:

  • 确保文件权限和用户匹配. https://askubuntu.com/questions/189189/how-to-run-crontab-as-userwww-data 我知道您会说这只是root",但是由于我们在此处看不到所有内容,因此可能存在一些错误.
  • 确保以正确的方式编辑选项卡(crontab命令)
  • 确保时间定义是您真正的意思.您的脚本将在上午9:55运行,您服务器的当前时间是几点?
  • Make sure the file permissions and the user are matching. https://askubuntu.com/questions/189189/how-to-run-crontab-as-userwww-data I know you'll say "it's just root", but as we don't see everything here, maybe there's some mistake.
  • Make sure you edit the tab the right way (crontab command)
  • Make sure the time definition are what you really mean. Your script will be run at 9:55 am, and what is the current time of your server?

因此,我建议首先编写一个仅包含星星的定义,以便每分钟调用一次,然后首先调用一些回声以进行观察.然后将回显更改为真正的PHP命令,然后再次观察.之后,设置时间参数并检查服务器时间.那应该做.

So I suggest first write a definition with only stars to have every minute a call, and first call just some echo to observe. Then alter the echo to your real PHP command and observe again. After that, set the time parameter and check the server time. That should do it.

这篇关于Symfony2命令不适用于cron的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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