• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

Symfony2命令不适用于cron

用户头像
it1352
帮助1

问题说明

该命令在手动调用时有效,但在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

对我来说就是这样.

正确答案

#1

有时,如果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.

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcfgcfk
系列文章
更多 icon
同类精品
更多 icon
继续加载