update to 6.8.27

This commit is contained in:
aaPanel
2022-12-16 10:40:55 +08:00
parent d2a66661db
commit 7dcaa2b5ce
148 changed files with 22281 additions and 13876 deletions
+28 -3
View File
@@ -15,6 +15,9 @@
import sys
import os
import logging
import datetime
import threading
from json import dumps, loads
from psutil import Process, pids, cpu_count, cpu_percent, net_io_counters, disk_io_counters, virtual_memory
os.environ['BT_TASK'] = '1'
@@ -98,7 +101,6 @@ def ExecShell(cmdstring, cwd=None, timeout=None, shell=True, symbol = '&>'):
try:
global logPath
import shlex
import datetime
import subprocess
import time
sub = subprocess.Popen(cmdstring+ symbol +logPath, cwd=cwd,
@@ -425,12 +427,16 @@ def check502Task():
while True:
check502()
sess_expire()
mysql_quota_check()
time.sleep(600)
except Exception as ex:
logging.info(ex)
time.sleep(600)
check502Task()
# MySQL配额检查
def mysql_quota_check():
os.system(get_python_bin() +" /www/server/panel/script/mysql_quota.py > /dev/null")
# session过期处理
def sess_expire():
@@ -494,7 +500,7 @@ def panel_status():
def update_panel():
os.system("curl http://download.bt.cn/install/update6_en.sh|bash &")
os.system("curl https://download.bt.cn/install/update6_en.sh|bash &")
def service_panel(action='reload'):
@@ -602,6 +608,23 @@ def check_files_panel():
public.writeFile(cf, i['body'])
os.system("bash {}/init.sh reload &".format(base_path))
def func():
os.system(get_python_bin() + " {}/script/scan_log.py > /dev/null".format(base_path))
#如果需要循环调用,就要添加以下方法
timer = threading.Timer(86400, func)
timer.start()
def scan_log_site():
now_time = datetime.datetime.now()
next_time = now_time + datetime.timedelta(days=+1)
next_year = next_time.date().year
next_month = next_time.date().month
next_day = next_time.date().day
next_time = datetime.datetime.strptime(str(next_year) + "-" + str(next_month) + "-" + str(next_day) + " 03:00:00",
"%Y-%m-%d %H:%M:%S")
timer_start_time = (next_time - now_time).total_seconds()
timer = threading.Timer(timer_start_time, func)
timer.start()
# 面板消息提醒
# def check_panel_msg():
@@ -634,7 +657,6 @@ def main():
datefmt='%Y-%m-%d %H:%M:%S', filename=task_log_file, filemode='a+')
logging.info('Service started')
import threading
t = threading.Thread(target=systemTask)
t.setDaemon(True)
t.start()
@@ -672,6 +694,9 @@ def main():
# p = threading.Thread(target=check_panel_msg)
# p.setDaemon(True)
# p.start()
p = threading.Thread(target=scan_log_site)
p.setDaemon(True)
p.start()
startTask()