douyin2883 2014-04-27 13:19 采纳率: 0%
浏览 71

cron jobs有时无法运行php脚本

I am using php file_get_contents function to get some data from other websites.Also i use cron jobs to run that script automatically.The cronjobs works fine but sometimes fails to run. this is my command in cron jobs (in cpanel):

*/10 * * * * /usr/bin/php -q public_html/include/imp.php > /dev/null 2>&1

this command should repeat every 10 minutes.but not work sometimes even for 48 hours. it's ok when i run that php script manually.

thank you.

  • 写回答

1条回答

  • dongye3917 2014-12-19 21:42
    关注

    I had a similar issue, the script ran fine when the URL was visited directly, and would run sometimes, seemingly randomly. Turns out it was host server resource issue. Hostgator wont run a cron job when I'm connected via SSH with Putty on 2 computers.

    From their help pages "SSH access is limited to two simultaneous connections on Shared and Reseller plans. Note: Any cron jobs configured will require one of these sessions to be available in order to run, since cron jobs run under the same shell as SSH."

    When I close the SSH connection, the cron job immediately runs.

    Maybe your host has a similar rule?

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题