doudu9148 2014-07-28 07:15
浏览 39
已采纳

Symfony2命令不与cron一起工作

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.

command in cron is:

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

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

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

if its not working

  • Check cron status

    sudo su
    /etc/init.d/cron status
    

    if it returns failed

    /etc/init.d/cron start
    

    was the case for me.

  • 写回答

1条回答 默认 最新

  • doujiu7680 2014-07-28 07:38
    关注

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

    • 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?

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 运筹学排序问题中的在线排序
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧