mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-09 23:39:25 +08:00
@@ -10,6 +10,8 @@ if systemctl is-active --quiet "$service_name"; then
|
||||
# 检查是否存在僵尸进程
|
||||
zombie_processes=$(ps -ef | grep -i openresty | grep -v grep | awk '{print $2}' | xargs ps -o state= -p 2>/dev/null | grep -c Z)
|
||||
if [ "$zombie_processes" -gt 0 ]; then
|
||||
echo "kill nginx 僵尸进程"
|
||||
ps -ef|grep nginx| grep -v grep| awk '{print $2}' | xargs kill -9
|
||||
echo "检测到OpenResty僵尸进程,正在重启服务..."
|
||||
systemctl restart "$service_name"
|
||||
echo "服务已重启"
|
||||
@@ -17,7 +19,17 @@ if systemctl is-active --quiet "$service_name"; then
|
||||
echo "OpenResty运行正常"
|
||||
fi
|
||||
else
|
||||
echo "kill nginx"
|
||||
ps -ef|grep nginx| grep -v grep| awk '{print $2}' | xargs kill -9
|
||||
echo "OpenResty未运行,正在启动服务..."
|
||||
systemctl start "$service_name"
|
||||
echo "服务已启动"
|
||||
fi
|
||||
|
||||
NGINX_IDS=`ps -ef|grep nginx | grep -v grep| awk '{print $2}'`
|
||||
if [ "$NGINX_IDS" == "" ];then
|
||||
ps -ef|grep nginx| grep -v grep| awk '{print $2}' | xargs kill -9
|
||||
systemctl start "$service_name"
|
||||
echo "OpenResty未运行,正在启动服务..."
|
||||
fi
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ from .user import init_admin_user
|
||||
from .option import init_option
|
||||
from .init_db_system import init_db_system
|
||||
from .init_cmd import init_cmd
|
||||
from .init_cron import init_cron,init_acme_cron
|
||||
from .init_cron import init_cron,init_acme_cron, init_auto_update
|
||||
|
||||
from utils.firewall import Firewall as MwFirewall
|
||||
|
||||
@@ -34,6 +34,7 @@ def init():
|
||||
thisdb.reinstallPanelData()
|
||||
init_cmd()
|
||||
init_acme_cron()
|
||||
init_auto_update()
|
||||
# init_cron()
|
||||
|
||||
|
||||
|
||||
@@ -60,6 +60,32 @@ def init_acme_cron():
|
||||
crontab.instance().add(params)
|
||||
return True
|
||||
|
||||
def init_auto_update():
|
||||
name = "[可删]面板自动更新"
|
||||
res = mw.M("crontab").field("id, name").where("name=?", (name,)).find()
|
||||
if res:
|
||||
return True
|
||||
|
||||
cmd = "mw update"
|
||||
params = {
|
||||
'name': name,
|
||||
'type': 'month',
|
||||
'week': "",
|
||||
'where1': "1",
|
||||
'hour': 4,
|
||||
'minute': 15,
|
||||
'save': "",
|
||||
'backup_to': "",
|
||||
'stype': "toShell",
|
||||
'sname': '',
|
||||
'sbody': cmd,
|
||||
'url_address': '',
|
||||
'attr':'',
|
||||
}
|
||||
|
||||
crontab.instance().add(params)
|
||||
return True
|
||||
|
||||
# 识别linux计划任务
|
||||
def init_cron():
|
||||
file = ''
|
||||
|
||||
Reference in New Issue
Block a user