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 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算