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 MATLAB yalmip 可转移负荷的简单建模出错,如何解决?
  • ¥15 数学的三元一次方程求解
  • ¥20 iqoo11 如何下载安装工程模式
  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?