是否有任何 Cron 工作替代?

2022-01-03 00:00:00 cron php jobs

我的服务器上的 Cron 作业已关闭,服务器管理员不接受打开它.因为,cron 作业会减慢服务器等速度.所以,我需要一个替代方案.

Cron Jobs are closed on my server and server admin doesn't accept open it. Because , cron jobs slowing server etc. So, i need an alternative.

我必须每 2 分钟运行一次 php 文件 (cron.php).

I have to run a php file (cron.php) every 2 minutes.

那么,我该怎么做?

推荐答案

虽然这个问题是很久以前发布的,但我也遇到了同样的问题但是找到了解决方案(基于 Kissaki 的回答,谢谢!)我想我会把它贴在这里供任何仍在寻找可能解决方案的人使用.

Even though the question was posted a while ago, I just had the same problem but found a solution (based on Kissaki's answer, thanks!) and thought I'd post it here for anyone still looking for a possible solution.

先决条件:

  • SSH 访问
  • Python

代码(python):

from subprocess import call
import time
while True:
    call(["php","cron.php"])
    time.sleep(120)

相关文章