dongshan6870 2012-08-18 20:57
浏览 38
已采纳

如何处理大量的Cron作业

My webserver is running cpanel and has a Cron job module in it providing a GUI to add/remove/edit cron jobs.

Problem: I need to create a large number of cron jobs (more than 100). Each cronjob simply does a wget <url> to trigger a bunch of PHP functions. What will be the best way to manage them? The current problem with cPanel's Cron GUI is that there will be no organization in the cron jobs. If I have 5 related cron jobs, added seperately admist 100 other unrelated cron jobs, it will get harder to find these cron jobs in the long list of cron jobs.

Should I stick to cPanel's GUI? Or is there an alternative GUI with better features like folders or the ability to move cron jobs up and down the list? Or should I just have 1 cron job, which calls a PHP file that does the various wget in PHP using CURL, with a table and stores the jobs in a MySQL database, essentially creating my own version of cron that runs off a single cronjob which triggers every minute?

  • 写回答

2条回答 默认 最新

  • donglv9813 2012-08-18 21:01
    关注

    Try grouping them.

    Say you have 10 groups of ten, depending on how you organise them.

    Each one of the cron jobs calls a PHP script that calls 10 other PHP scripts.

    If you need them run at different times you could do a simple check with time() to see which scripts should be called.

    You could call them the other PHP scripts using cURL.

    Make sure to set a large script timeout though, or you might end up with lots of things going wrong.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 opencv 无法读取视频
  • ¥15 用matlab 实现通信仿真
  • ¥15 按键修改电子时钟,C51单片机
  • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))
  • ¥20 5037端口被adb自己占了
  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图