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.
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfgcfk
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20 -
希伯来语的空格句子标记化错误
it1352 06-22