本文介绍了是否有任何 Cron 工作替代?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我的服务器上的 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)
这篇关于是否有任何 Cron 工作替代?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!