当前状态:'+(status ? '开启' : '关闭' )+ + '
| 服务器版本(ServerVersion) | " + (rdata.ServerVersion || '-') + " |
|---|---|
| 服务器MPM(ServerMPM) | " + (rdata.ServerMPM || '-') + " |
| 服务器构建时间(Server Built) | " + (rdata['Server Built'] || '-') + " |
| 当前时间(CurrentTime) | " + (rdata.CurrentTime || '-') + " |
| 重启时间(RestartTime) | " + (rdata.RestartTime || '-') + " |
| 服务器运行时间(ServerUptime) | " + (rdata.ServerUptime || '-') + " |
| 服务器运行秒数(ServerUptimeSeconds) | " + (rdata.ServerUptimeSeconds || '-') + " |
| 1分钟负载(Load1) | " + (rdata.Load1 || '-') + " |
| 5分钟负载(Load5) | " + (rdata.Load5 || '-') + " |
| 15分钟负载(Load15) | " + (rdata.Load15 || '-') + " |
| 总访问次数(Total Accesses) | " + (rdata['Total Accesses'] || '-') + " |
| 总流量(Total kBytes) | " + (rdata['Total kBytes'] || '-') + " KB |
| 总请求时间(Total Duration) | " + (rdata['Total Duration'] || '-') + " |
| CPU用户时间(CPUUser) | " + (rdata.CPUUser || '-') + " |
| CPU系统时间(CPUSystem) | " + (rdata.CPUSystem || '-') + " |
| CPU负载(CPULoad) | " + (rdata.CPULoad || '-') + " |
| 每秒请求数(ReqPerSec) | " + (rdata.ReqPerSec || '-') + " |
| 每秒流量(BytesPerSec) | " + (rdata.BytesPerSec || '-') + " |
| 每请求流量(BytesPerReq) | " + (rdata.BytesPerReq || '-') + " |
| 每请求时间(DurationPerReq) | " + (rdata.DurationPerReq || '-') + " |
| 活动工作进程(BusyWorkers) | " + (rdata.BusyWorkers || '-') + " |
| 优雅关闭进程(GracefulWorkers) | " + (rdata.GracefulWorkers || '-') + " |
| 空闲工作进程(IdleWorkers) | " + (rdata.IdleWorkers || '-') + " |
| 进程数(Processes) | " + (rdata.Processes || '-') + " |
| 总连接数(ConnsTotal) | " + (rdata.ConnsTotal || '-') + " |
' + rdata[i].name + '' + ibody + ""+rdata[i].unit+"" +', ' + rdata[i].ps + '
'; + } + var con = '\ + \ + \ +
'; + $(".soft-man-con").html(con); +} + +function cronAddCheck(){ + httpPost('cron_add_check', {}, function(data){ + var rdata = $.parseJSON(data.data); + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + }); +} + +function cronDelCheck(){ + httpPost('cron_del_check', {}, function(data){ + var rdata = $.parseJSON(data.data); + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + }); +} + + + + + + + + + + + + diff --git a/plugins/apache/tool_task.py b/plugins/apache/tool_task.py new file mode 100644 index 000000000..4be4006f8 --- /dev/null +++ b/plugins/apache/tool_task.py @@ -0,0 +1,124 @@ +# coding:utf-8 + +import sys +import io +import os +import time +import json + +web_dir = os.getcwd() + "/web" +if os.path.exists(web_dir): + sys.path.append(web_dir) + os.chdir(web_dir) + +import core.mw as mw +from utils.crontab import crontab as MwCrontab + + +app_debug = False +if mw.isAppleSystem(): + app_debug = True + + +def getPluginName(): + return 'apache' + + +def getPluginDir(): + return mw.getPluginDir() + '/' + getPluginName() + + +def getServerDir(): + return mw.getServerDir() + '/' + getPluginName() + + +def getTaskConf(): + conf = getServerDir() + "/task_config.json" + return conf + + +def getConfigData(): + conf = getTaskConf() + if os.path.exists(conf): + return json.loads(mw.readFile(getTaskConf())) + return { + "task_id": -1, + "period": "minute-n", + "where1": "3", + "hour": "0", + "minute": "0", + } + + +def createBgTask(): + removeBgTask() + createBgTaskByName(getPluginName()) + + +def createBgTaskByName(name): + args = getConfigData() + _name = "[apache]检查任务" + res = mw.M("crontab").field("id, name").where("name=?", (_name,)).find() + if res: + return True + + if "task_id" in args and args["task_id"] > 0: + res = mw.M("crontab").field("id, name").where( + "id=?", (args["task_id"],)).find() + if res and res["id"] == args["task_id"]: + print("计划任务已经存在!") + return True + + mw_dir = mw.getPanelDir() + cmd = ''' +mw_dir=%s +rname=%s +plugin_path=%s +script_path=%s +''' % (mw_dir, name, getServerDir(), getPluginDir()) + cmd += 'echo "bash $script_path/check.sh"' + "\n" + cmd += 'cd $mw_dir && bash $script_path/check.sh' + "\n" + + params = { + 'name': _name, + 'type': args['period'], + 'week': "", + 'where1': args['where1'], + 'hour': args['hour'], + 'minute': args['minute'], + 'save': "", + 'backup_to': "", + 'stype': "toShell", + 'sname': '', + 'sbody': cmd, + 'url_address': '', + } + + task_id = MwCrontab.instance().add(params) + if task_id > 0: + args["task_id"] = task_id + args["name"] = name + mw.writeFile(getTaskConf(), json.dumps(args)) + + +def removeBgTask(): + cfg = getConfigData() + if "task_id" in cfg and cfg["task_id"] > 0: + res = mw.M("crontab").field("id, name").where( + "id=?", (cfg["task_id"],)).find() + if res and res["id"] == cfg["task_id"]: + data = MwCrontab.instance().delete(cfg["task_id"]) + if data["status"]: + cfg["task_id"] = -1 + mw.writeFile(getTaskConf(), json.dumps(cfg)) + return True + return False + + +if __name__ == "__main__": + if len(sys.argv) > 1: + action = sys.argv[1] + if action == "remove": + removeBgTask() + elif action == "add": + createBgTask() diff --git a/plugins/apache/versions/2.4/install.sh b/plugins/apache/versions/2.4/install.sh new file mode 100644 index 000000000..4825acbf6 --- /dev/null +++ b/plugins/apache/versions/2.4/install.sh @@ -0,0 +1,172 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin +export PATH + +# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/apache && bash install.sh install 2.4 +# cd /www/server/mdserver-web/plugins/apache && bash install.sh install 2.4 + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") + +sysName=`uname` +action=$1 +type=$2 + +VERSION=2.4.66 +apacheDir=${serverPath}/source/apache + +Install_App() +{ + if [ "${action}" == "install" ];then + if [ -d $serverPath/apache ];then + exit 0 + fi + fi + + # ----- cpu start ------ + if [ -z "${cpuCore}" ]; then + cpuCore="1" + fi + + if [ -f /proc/cpuinfo ];then + cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l` + fi + + MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}') + if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then + if [ "${cpuCore}" -gt "${MEM_INFO}" ];then + cpuCore="${MEM_INFO}" + fi + else + cpuCore="1" + fi + + if [ "$cpuCore" -gt "2" ];then + cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'` + else + cpuCore="1" + fi + # ----- cpu end ------ + + mkdir -p ${apacheDir} + echo 'install script ...' + OPTIONS='' + + # 安装 APR 和 APR-util + APR_VERSION=1.7.6 + APR_UTIL_VERSION=1.6.3 + + if [ ! -f ${apacheDir}/apr-${APR_VERSION}.tar.bz2 ];then + wget --no-check-certificate -O ${apacheDir}/apr-${APR_VERSION}.tar.bz2 https://downloads.apache.org/apr/apr-${APR_VERSION}.tar.bz2 -T 3 + fi + + if [ ! -f ${apacheDir}/apr-util-${APR_UTIL_VERSION}.tar.bz2 ];then + wget --no-check-certificate -O ${apacheDir}/apr-util-${APR_UTIL_VERSION}.tar.bz2 https://downloads.apache.org/apr/apr-util-${APR_UTIL_VERSION}.tar.bz2 -T 3 + fi + + # 安装 APR + if [ ! -d ${serverPath}/apache/apr ];then + cd ${apacheDir} && tar -jxf apr-${APR_VERSION}.tar.bz2 + cd ${apacheDir}/apr-${APR_VERSION} && ./configure --prefix=${serverPath}/apache/apr + make -j${cpuCore} && make install + if [ "$?" == "0" ];then + # 检查 APR 配置文件 + APR_CONFIG=$(find ${serverPath}/apache/apr -name "apr-*config" | head -1) + if [ -z "$APR_CONFIG" ];then + echo "APR installation failed: apr-config not found" + exit 1 + fi + echo "APR installed successfully: $APR_CONFIG" + else + echo "APR configure failed" + exit 1 + fi + fi + + # 安装 APR-util + if [ ! -d ${serverPath}/apache/apr-util ];then + cd ${apacheDir} && tar -jxf apr-util-${APR_UTIL_VERSION}.tar.bz2 + cd ${apacheDir}/apr-util-${APR_UTIL_VERSION} && ./configure --prefix=${serverPath}/apache/apr-util --with-apr=${serverPath}/apache/apr + make -j${cpuCore} && make install + if [ "$?" == "0" ];then + # 检查 APR-util 配置文件 + APU_CONFIG=$(find ${serverPath}/apache/apr-util -name "apu-*config" | head -1) + if [ -z "$APU_CONFIG" ];then + echo "APR-util installation failed: apu-config not found" + find ${serverPath}/apache/apr-util -name "apu-*config" + exit 1 + fi + echo "APR-util installed successfully: $APU_CONFIG" + else + echo "APR-util configure failed" + exit 1 + fi + fi + + if [ ! -f ${apacheDir}/httpd-${VERSION}.tar.bz2 ];then + wget --no-check-certificate -O ${apacheDir}/httpd-${VERSION}.tar.bz2 https://downloads.apache.org/httpd/httpd-${VERSION}.tar.bz2 -T 3 + fi + + if [ ! -d ${apacheDir}/httpd-${VERSION} ];then + cd ${apacheDir} && tar -jxf ${apacheDir}/httpd-${VERSION}.tar.bz2 + fi + + + # 检查 APR 和 APR-util 可执行文件 + APR_CONFIG=$(find ${serverPath}/apache/apr -name "apr-*config" | head -1) + APU_CONFIG=$(find ${serverPath}/apache/apr-util -name "apu-*config" | head -1) + + if [ -z "$APR_CONFIG" ];then + echo "APR config not found" + exit 1 + fi + + if [ -z "$APU_CONFIG" ];then + echo "APR-util config not found" + exit 1 + fi + + OPTIONS="${OPTIONS} --with-apr=$APR_CONFIG" + OPTIONS="${OPTIONS} --with-apr-util=$APU_CONFIG" + + # if [ "$sysName" != "Darwin" ];then + # OPTIONS="${OPTIONS} --enable-systemd" + # fi + # echo "cd ${apacheDir}/httpd-${VERSION} && ./configure --prefix=$serverPath/apache $OPTIONS" + cd ${apacheDir}/httpd-${VERSION} && ./configure \ + --prefix=$serverPath/apache/httpd \ + $OPTIONS + + make -j${cpuCore} && make install && make clean + + + if [ -d ${apacheDir}/apr-${APR_VERSION} ];then + rm -rf ${apacheDir}/apr-${APR_VERSION} + fi + + if [ -d ${apacheDir}/apr-util-${APR_UTIL_VERSION} ];then + rm -rf ${apacheDir}/apr-util-${APR_UTIL_VERSION} + fi + + if [ -d ${apacheDir}/httpd-${APR_UTIL_VERSION} ];then + rm -rf ${apacheDir}/httpd-${APR_UTIL_VERSION} + fi + + echo 'installation of apache completed' +} + +Uninstall_App() +{ + echo 'uninstalling apache completed' +} + +action=$1 +if [ "${1}" == "install" ];then + Install_App +elif [ "${1}" == "upgrade" ];then + Install_App +else + Uninstall_App +fi diff --git a/plugins/caddy/check.sh b/plugins/caddy/check.sh new file mode 100755 index 000000000..4cb2277cc --- /dev/null +++ b/plugins/caddy/check.sh @@ -0,0 +1,35 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin +export PATH + +# OpenResty服务名称 +service_name="caddy" + +# 检查OpenResty是否正在运行 +if systemctl is-active --quiet "$service_name"; then + # 检查是否存在僵尸进程 + zombie_processes=$(ps -ef | grep -i caddy | 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 caddy 僵尸进程" + ps -ef|grep caddy| grep -v grep| awk '{print $2}' | xargs kill -9 + echo "检测到OpenResty僵尸进程,正在重启服务..." + systemctl restart "$service_name" + echo "服务已重启" + else + echo "OpenResty运行正常" + fi +else + echo "kill caddy" + ps -ef|grep caddy| grep -v grep| awk '{print $2}' | xargs kill -9 + echo "caddy未运行,正在启动服务..." + systemctl start "$service_name" + echo "服务已启动" +fi + +NGINX_IDS=`ps -ef|grep caddy | grep -v grep| awk '{print $2}'` +if [ "$NGINX_IDS" == "" ];then + ps -ef|grep caddy| grep -v grep| awk '{print $2}' | xargs kill -9 + systemctl start "$service_name" + echo "caddy未运行,正在启动服务..." +fi + diff --git a/plugins/caddy/conf/Caddyfile b/plugins/caddy/conf/Caddyfile new file mode 100644 index 000000000..98594e3a2 --- /dev/null +++ b/plugins/caddy/conf/Caddyfile @@ -0,0 +1,13 @@ +:8080 { + # Set this path to your site's directory. + root * /tmp + + # Enable the static file server. + file_server + + # Another common task is to set up a reverse proxy: + # reverse_proxy localhost:8080 + + # Or serve a PHP site through php-fpm: + # php_fastcgi localhost:9000 +} \ No newline at end of file diff --git a/plugins/caddy/ico.png b/plugins/caddy/ico.png new file mode 100644 index 000000000..91071011e Binary files /dev/null and b/plugins/caddy/ico.png differ diff --git a/plugins/caddy/index.html b/plugins/caddy/index.html new file mode 100755 index 000000000..92cba9ba6 --- /dev/null +++ b/plugins/caddy/index.html @@ -0,0 +1,24 @@ +当前状态:'+(status ? '开启' : '关闭' )+ + '
| 活动连接(Active connections) | " + rdata.active + " |
|---|---|
| 总连接次数(accepts) | " + rdata.accepts + " |
| 总握手次数(handled) | " + rdata.handled + " |
| 总请求数(requests) | " + rdata.requests + " |
| 请求数(Reading) | " + rdata.Reading + " |
| 响应数(Writing) | " + rdata.Writing + " |
| 驻留进程(Waiting) | " + rdata.Waiting + " |
' + rdata[i].name + '' + ibody + ""+rdata[i].unit+"" +', ' + rdata[i].ps + '
'; + } + var con = '\ + \ + \ +
'; + $(".soft-man-con").html(con); +} + +function cronAddCheck(){ + caddyPost('cron_add_check', {}, function(data){ + var rdata = $.parseJSON(data.data); + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + }); +} + +function cronDelCheck(){ + caddyPost('cron_del_check', {}, function(data){ + var rdata = $.parseJSON(data.data); + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + }); +} + + + + + + + + + + + + diff --git a/plugins/caddy/tool_task.py b/plugins/caddy/tool_task.py new file mode 100644 index 000000000..f20ba8348 --- /dev/null +++ b/plugins/caddy/tool_task.py @@ -0,0 +1,124 @@ +# coding:utf-8 + +import sys +import io +import os +import time +import json + +web_dir = os.getcwd() + "/web" +if os.path.exists(web_dir): + sys.path.append(web_dir) + os.chdir(web_dir) + +import core.mw as mw +from utils.crontab import crontab as MwCrontab + + +app_debug = False +if mw.isAppleSystem(): + app_debug = True + + +def getPluginName(): + return 'caddy' + + +def getPluginDir(): + return mw.getPluginDir() + '/' + getPluginName() + + +def getServerDir(): + return mw.getServerDir() + '/' + getPluginName() + + +def getTaskConf(): + conf = getServerDir() + "/task_config.json" + return conf + + +def getConfigData(): + conf = getTaskConf() + if os.path.exists(conf): + return json.loads(mw.readFile(getTaskConf())) + return { + "task_id": -1, + "period": "minute-n", + "where1": "3", + "hour": "0", + "minute": "0", + } + + +def createBgTask(): + removeBgTask() + createBgTaskByName(getPluginName()) + + +def createBgTaskByName(name): + args = getConfigData() + _name = "[caddy]检查任务" + res = mw.M("crontab").field("id, name").where("name=?", (_name,)).find() + if res: + return True + + if "task_id" in args and args["task_id"] > 0: + res = mw.M("crontab").field("id, name").where( + "id=?", (args["task_id"],)).find() + if res and res["id"] == args["task_id"]: + print("计划任务已经存在!") + return True + + mw_dir = mw.getPanelDir() + cmd = ''' +mw_dir=%s +rname=%s +plugin_path=%s +script_path=%s +''' % (mw_dir, name, getServerDir(), getPluginDir()) + cmd += 'echo "bash $script_path/check.sh"' + "\n" + cmd += 'cd $mw_dir && bash $script_path/check.sh' + "\n" + + params = { + 'name': _name, + 'type': args['period'], + 'week': "", + 'where1': args['where1'], + 'hour': args['hour'], + 'minute': args['minute'], + 'save': "", + 'backup_to': "", + 'stype': "toShell", + 'sname': '', + 'sbody': cmd, + 'url_address': '', + } + + task_id = MwCrontab.instance().add(params) + if task_id > 0: + args["task_id"] = task_id + args["name"] = name + mw.writeFile(getTaskConf(), json.dumps(args)) + + +def removeBgTask(): + cfg = getConfigData() + if "task_id" in cfg and cfg["task_id"] > 0: + res = mw.M("crontab").field("id, name").where( + "id=?", (cfg["task_id"],)).find() + if res and res["id"] == cfg["task_id"]: + data = MwCrontab.instance().delete(cfg["task_id"]) + if data["status"]: + cfg["task_id"] = -1 + mw.writeFile(getTaskConf(), json.dumps(cfg)) + return True + return False + + +if __name__ == "__main__": + if len(sys.argv) > 1: + action = sys.argv[1] + if action == "remove": + removeBgTask() + elif action == "add": + createBgTask() diff --git a/plugins/caddy/versions/2.11/install.sh b/plugins/caddy/versions/2.11/install.sh new file mode 100644 index 000000000..e97027b78 --- /dev/null +++ b/plugins/caddy/versions/2.11/install.sh @@ -0,0 +1,87 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin +export PATH + +# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/caddy && bash install.sh install 2.11 +# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/caddy && bash install.sh upgrade 2.11 +# cd /www/server/mdserver-web/plugins/caddy && bash install.sh install 2.11 + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") + +sysName=`uname` +action=$1 +type=$2 + +OS=`uname` +OSNAME='' +case $(uname) in + Darwin) OSNAME="mac" ;; + Linux) OSNAME="linux" ;; +esac + +ARCH=`uname -m` +ARCH_NAME='' +case $(uname -m) in + i386) ARCH_NAME="386" ;; + i686) ARCH_NAME="386" ;; + x86_64) ARCH_NAME="amd64" ;; + arm) ARCH_NAME="arm64" ;; + arm64) ARCH_NAME="arm64" ;; +esac + +VERSION=2.11.2 + +caddyDir=${serverPath}/source/caddy + +Install_App() +{ + if [ "${action}" == "install" ];then + if [ -d $serverPath/caddy ];then + exit 0 + fi + fi + + mkdir -p ${caddyDir} + # mkdir -p ${serverPath}/caddy + echo 'install scripts ...' + + FILE_NAME="caddy_${VERSION}_${OSNAME}_${ARCH_NAME}.tar.gz" + + if [ ! -f ${caddyDir}/${FILE_NAME} ];then + wget --no-check-certificate -O ${caddyDir}/${FILE_NAME} "https://github.com/caddyserver/caddy/releases/download/v${VERSION}/${FILE_NAME}" + fi + + + echo "cd $serverPath/source/caddy/caddy && tar -zxvf ${caddyDir}/$FILE_NAME" + + mkdir -p cd $serverPath/source/caddy/caddy + cd $serverPath/source/caddy/caddy && tar -zxvf ${caddyDir}/$FILE_NAME + if [ "$OSNAME" == "mac" ];then + xattr -cr caddy + fi + + if [ ! -f $serverPath/caddy/bin ];then + mkdir -p $serverPath/caddy/bin + mv $serverPath/source/caddy/caddy/* $serverPath/caddy/bin + chmod +x $serverPath/caddy/bin/caddy + fi + + echo 'Installation of caddy completed' +} + +Uninstall_App() +{ + echo 'Uninstalling caddy completed' +} + +action=$1 +if [ "${1}" == "install" ];then + Install_App +elif [ "${1}" == "upgrade" ];then + Install_App +else + Uninstall_App +fi diff --git a/plugins/clean/index.py b/plugins/clean/index.py index d712d1078..2ddbdf30e 100755 --- a/plugins/clean/index.py +++ b/plugins/clean/index.py @@ -160,6 +160,7 @@ def initConf(): "/www/server/php/85/var/log", "/www/server/openresty/nginx/logs", "/www/server/phpmyadmin", + "/www/server/apache/httpd/logs", "/www/server/redis/data", "/www/server/alist/data/log", "/www/server/dztasks/logs", diff --git a/plugins/haproxy/info.json b/plugins/haproxy/info.json index 98700f813..2bdc07622 100755 --- a/plugins/haproxy/info.json +++ b/plugins/haproxy/info.json @@ -4,7 +4,7 @@ "name": "haproxy", "title": "haproxy", "shell": "install.sh", - "versions":["2.6"], + "versions":["2.6","2.8","3.0","3.2"], "updates":["2.6"], "tip": "soft", "checks": "server/haproxy", diff --git a/plugins/haproxy/tpl/tcp.tpl b/plugins/haproxy/tpl/tcp.tpl new file mode 100644 index 000000000..91600d3c9 --- /dev/null +++ b/plugins/haproxy/tpl/tcp.tpl @@ -0,0 +1,37 @@ +global + daemon + pidfile /tmp/haproxy.pid + maxconn 4000 + user haproxy + group haproxy + + +defaults + mode tcp + log local local0 + option tcplog + timeout connect 10s + timeout client 15s + timeout server 15s + + +listen stats + mode http + bind *:10800 + stats enable + stats refresh 10 + stats uri /haproxy + stats realm Haproxy\ Statistics + stats auth {$HA_USER}:{$HA_PWD} + + +frontend tcp_frontend + bind *:8090 + mode tcp + default_backend tcp_backend + +backend tcp_backend + mode tcp + server tcp1 192.168.1.100:8090 check + + diff --git a/plugins/haproxy/versions/2.8/install.sh b/plugins/haproxy/versions/2.8/install.sh new file mode 100755 index 000000000..f6e527064 --- /dev/null +++ b/plugins/haproxy/versions/2.8/install.sh @@ -0,0 +1,101 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") +sysName=`uname` + +bash ${rootPath}/scripts/getos.sh +OSNAME=`cat ${rootPath}/data/osname.pl` +OSNAME_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` + + +VERSION=2.8.20 +MIN_VERSION=2.8 +Install_App() +{ + echo '正在安装Haproxy软件...' + mkdir -p $serverPath/haproxy + + APP_DIR=${serverPath}/source/haproxy + mkdir -p $APP_DIR + echo $MIN_VERSION > $serverPath/haproxy/version.pl + + LOCAL_ADDR=common + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then + LOCAL_ADDR=cn + fi + + + if [ "${LOCAL_ADDR}" == "cn" ];then + if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then + wget -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://dl.midoks.icu/soft/haproxy/haproxy-${VERSION}.tar.gz + fi + fi + + + if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then + if [ $sysName == 'Darwin' ]; then + wget --no-check-certificate -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz + else + curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz + fi + fi + + if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then + curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz + fi + + + cd ${APP_DIR} && tar -zxvf haproxy-${VERSION}.tar.gz + + if [ "$OSNAME" == "macos" ];then + cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=osx && make install PREFIX=$serverPath/haproxy + else + cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=linux-glibc && make install PREFIX=$serverPath/haproxy + fi + + echo '安装Haproxy成功' + + #Haproxy日志配置 + if [ -f /etc/rsyslog.conf ];then + find_ha=`cat /etc/rsyslog.conf | grep haproxy` + if [ "$find_ha" != "" ];then + echo $find_ha + else + echo "---------------------------------------------" + echo "" > ${serverPath}/haproxy/haproxy.log + echo "local0.* ${serverPath}/haproxy/haproxy.log" >> /etc/rsyslog.conf + systemctl restart syslog + echo "syslog默认的haproxy配置" + echo "local0.* ${serverPath}/haproxy/haproxy.log >> /etc/rsyslog.conf" + echo "---------------------------------------------" + fi + fi + + #删除解压源码 + if [ -d ${APP_DIR}/haproxy-${VERSION} ];then + rm -rf ${APP_DIR}/haproxy-${VERSION} + fi +} + +Uninstall_App() +{ + if [ -f $serverPath/haproxy/initd/haproxy ];then + $serverPath/haproxy/initd/haproxy stop + fi + + rm -rf $serverPath/haproxy + echo "卸载Haproxy成功" +} + +action=$1 +if [ "${1}" == 'install' ];then + Install_App +else + Uninstall_App +fi diff --git a/plugins/haproxy/versions/3.0/install.sh b/plugins/haproxy/versions/3.0/install.sh new file mode 100755 index 000000000..0e586755f --- /dev/null +++ b/plugins/haproxy/versions/3.0/install.sh @@ -0,0 +1,101 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") +sysName=`uname` + +bash ${rootPath}/scripts/getos.sh +OSNAME=`cat ${rootPath}/data/osname.pl` +OSNAME_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` + + +VERSION=3.0.19 +MIN_VERSION=3.0 +Install_App() +{ + echo '正在安装Haproxy软件...' + mkdir -p $serverPath/haproxy + + APP_DIR=${serverPath}/source/haproxy + mkdir -p $APP_DIR + echo $MIN_VERSION > $serverPath/haproxy/version.pl + + LOCAL_ADDR=common + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then + LOCAL_ADDR=cn + fi + + + if [ "${LOCAL_ADDR}" == "cn" ];then + if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then + wget -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://dl.midoks.icu/soft/haproxy/haproxy-${VERSION}.tar.gz + fi + fi + + + if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then + if [ $sysName == 'Darwin' ]; then + wget --no-check-certificate -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz + else + curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz + fi + fi + + if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then + curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz + fi + + + cd ${APP_DIR} && tar -zxvf haproxy-${VERSION}.tar.gz + + if [ "$OSNAME" == "macos" ];then + cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=osx && make install PREFIX=$serverPath/haproxy + else + cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=linux-glibc && make install PREFIX=$serverPath/haproxy + fi + + echo '安装Haproxy成功' + + #Haproxy日志配置 + if [ -f /etc/rsyslog.conf ];then + find_ha=`cat /etc/rsyslog.conf | grep haproxy` + if [ "$find_ha" != "" ];then + echo $find_ha + else + echo "---------------------------------------------" + echo "" > ${serverPath}/haproxy/haproxy.log + echo "local0.* ${serverPath}/haproxy/haproxy.log" >> /etc/rsyslog.conf + systemctl restart syslog + echo "syslog默认的haproxy配置" + echo "local0.* ${serverPath}/haproxy/haproxy.log >> /etc/rsyslog.conf" + echo "---------------------------------------------" + fi + fi + + #删除解压源码 + if [ -d ${APP_DIR}/haproxy-${VERSION} ];then + rm -rf ${APP_DIR}/haproxy-${VERSION} + fi +} + +Uninstall_App() +{ + if [ -f $serverPath/haproxy/initd/haproxy ];then + $serverPath/haproxy/initd/haproxy stop + fi + + rm -rf $serverPath/haproxy + echo "卸载Haproxy成功" +} + +action=$1 +if [ "${1}" == 'install' ];then + Install_App +else + Uninstall_App +fi diff --git a/plugins/haproxy/versions/3.2/install.sh b/plugins/haproxy/versions/3.2/install.sh new file mode 100755 index 000000000..ef20c4167 --- /dev/null +++ b/plugins/haproxy/versions/3.2/install.sh @@ -0,0 +1,101 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") +sysName=`uname` + +bash ${rootPath}/scripts/getos.sh +OSNAME=`cat ${rootPath}/data/osname.pl` +OSNAME_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` + + +VERSION=3.2.15 +MIN_VERSION=3.2 +Install_App() +{ + echo '正在安装Haproxy软件...' + mkdir -p $serverPath/haproxy + + APP_DIR=${serverPath}/source/haproxy + mkdir -p $APP_DIR + echo $MIN_VERSION > $serverPath/haproxy/version.pl + + LOCAL_ADDR=common + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then + LOCAL_ADDR=cn + fi + + + if [ "${LOCAL_ADDR}" == "cn" ];then + if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then + wget -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://dl.midoks.icu/soft/haproxy/haproxy-${VERSION}.tar.gz + fi + fi + + + if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then + if [ $sysName == 'Darwin' ]; then + wget --no-check-certificate -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz + else + curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz + fi + fi + + if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then + curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz + fi + + + cd ${APP_DIR} && tar -zxvf haproxy-${VERSION}.tar.gz + + if [ "$OSNAME" == "macos" ];then + cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=osx && make install PREFIX=$serverPath/haproxy + else + cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=linux-glibc && make install PREFIX=$serverPath/haproxy + fi + + echo '安装Haproxy成功' + + #Haproxy日志配置 + if [ -f /etc/rsyslog.conf ];then + find_ha=`cat /etc/rsyslog.conf | grep haproxy` + if [ "$find_ha" != "" ];then + echo $find_ha + else + echo "---------------------------------------------" + echo "" > ${serverPath}/haproxy/haproxy.log + echo "local0.* ${serverPath}/haproxy/haproxy.log" >> /etc/rsyslog.conf + systemctl restart syslog + echo "syslog默认的haproxy配置" + echo "local0.* ${serverPath}/haproxy/haproxy.log >> /etc/rsyslog.conf" + echo "---------------------------------------------" + fi + fi + + #删除解压源码 + if [ -d ${APP_DIR}/haproxy-${VERSION} ];then + rm -rf ${APP_DIR}/haproxy-${VERSION} + fi +} + +Uninstall_App() +{ + if [ -f $serverPath/haproxy/initd/haproxy ];then + $serverPath/haproxy/initd/haproxy stop + fi + + rm -rf $serverPath/haproxy + echo "卸载Haproxy成功" +} + +action=$1 +if [ "${1}" == 'install' ];then + Install_App +else + Uninstall_App +fi diff --git a/plugins/lvs/readme.md b/plugins/lvs/readme.md index 29ef5bd64..0254d7ef9 100644 --- a/plugins/lvs/readme.md +++ b/plugins/lvs/readme.md @@ -7,10 +7,15 @@ ifconfig ens256 172.16.204.100 netmask 255.255.255.255 broadcast 192.168.212.100 route add -host 172.16.204.100 dev ens256 - ipvsadm -A -t 172.16.204.100:80 -s rr ipvsadm -a -t 172.16.204.100:80 -r 172.16.204.129:80 -m +跨机房 +ipvsadm -A -t 154.21.1.1:8016 -s wlc +ipvsadm -a -t 154.21.1.1:8016 -r 103.39.78.2 -i +源 +ifconfig tunl0 154.21.1.1 netmask 255.255.255.255 up + # 清空LVS规则 ipvsadm -C diff --git a/plugins/openresty/install.sh b/plugins/openresty/install.sh index 722242d57..f4167b951 100755 --- a/plugins/openresty/install.sh +++ b/plugins/openresty/install.sh @@ -12,7 +12,7 @@ export PATH # curl --http3 -v https://www.xxx.com # apt install ncat -y -# nc -u -v www.xxmhaa.com 443 +# nc -u -v www.xx.com 443 # cd /www/server/mdserver-web && python3 plugins/openresty/index.py run_info diff --git a/plugins/openresty/versions/1.29.2/install.sh b/plugins/openresty/versions/1.29.2/install.sh index bdfb1f969..3542b6b4c 100644 --- a/plugins/openresty/versions/1.29.2/install.sh +++ b/plugins/openresty/versions/1.29.2/install.sh @@ -132,11 +132,11 @@ Install_openresty() fi # br - if [ ! -d ${openrestyDir}/openresty-${VERSION}/ngx_brotli ];then - cd ${openrestyDir}/openresty-${VERSION} && git clone https://github.com/wxx9248/ngx_brotli.git - cd ${openrestyDir}/openresty-${VERSION}/ngx_brotli && git submodule update --init + if [ ! -d ${openrestyDir}/ngx_brotli ];then + cd ${openrestyDir} && git clone https://github.com/wxx9248/ngx_brotli.git + cd ${openrestyDir}/ngx_brotli && git submodule update --init - OPTIONS="${OPTIONS} --add-module=${openrestyDir}/openresty-${VERSION}/ngx_brotli" + OPTIONS="${OPTIONS} --add-module=${openrestyDir}/ngx_brotli" fi OPTIONS="${OPTIONS} --with-threads" diff --git a/scripts/init.d/mw.tpl b/scripts/init.d/mw.tpl index bf11e6b71..1b6331151 100755 --- a/scripts/init.d/mw.tpl +++ b/scripts/init.d/mw.tpl @@ -48,11 +48,13 @@ mw_start_panel() cd ${PANEL_DIR}/web && gunicorn -c setting.py app:app port=$(cat ${PANEL_DIR}/data/port.pl) isStart="" + n=0 while [[ "$isStart" == "" ]]; do echo -e ".\c" sleep 0.5 - isStart=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $2}'|xargs) + # isStart=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $2}'|xargs) + isStart=$(ss -tulnp | grep ":$port" |grep LISTEN|grep -v grep|awk '{print $2}'|xargs) if [[ "$isStart" == "" ]];then isStart=$(ps -ef|grep python3|grep mdserver-web|grep app:app|awk '{print $2}'|xargs) fi @@ -132,7 +134,7 @@ mw_stop_task() mw_stop_panel() { echo -e "stopping mw-panel... \c"; - pidfile=${PANEL_DIR}/logs/mw.pid + pidfile=${PANEL_DIR}/logs/panel.pid if [ -f $pidfile ];then pid=`cat $pidfile` kill -9 $pid > /dev/null 2>&1 @@ -759,13 +761,19 @@ case "$1" in 'reload') mw_reload;; 'restart') mw_stop - mw_start;; + sleep 2 + mw_start + mw_default;; 'restart_panel') mw_stop_panel - mw_start_panel;; + sleep 2 + mw_start_panel + mw_default;; 'restart_task') - mw_stop_task - mw_start_task;; + mw_stop_task + sleep 2 + mw_start_task + mw_default;; 'status') mw_status;; 'logs') error_logs;; 'close') mw_close;; diff --git a/scripts/install/alma.sh b/scripts/install/alma.sh index 0b89004ce..02b3030b5 100755 --- a/scripts/install/alma.sh +++ b/scripts/install/alma.sh @@ -22,6 +22,7 @@ yum install -y numactl yum install -y sshpass yum install -y libzstd-devel yum install -y postgresql-devel +yum install -y brotli-devel SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` if [ "$SSH_PORT" == "" ];then diff --git a/scripts/install/amazon.sh b/scripts/install/amazon.sh index a16134e47..2b420026a 100755 --- a/scripts/install/amazon.sh +++ b/scripts/install/amazon.sh @@ -29,6 +29,7 @@ yum install -y ncurses-compat-libs yum install -y numactl yum install -y sshpass yum install -y libzstd-devel +yum install -y brotli-devel SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` if [ "$SSH_PORT" == "" ];then diff --git a/scripts/install/centos.sh b/scripts/install/centos.sh index 59ed47040..0165d647f 100755 --- a/scripts/install/centos.sh +++ b/scripts/install/centos.sh @@ -40,6 +40,7 @@ yum install -y numactl yum install -y sshpass yum install -y libzstd-devel yum install -y postgresql-devel +yum install -y brotli-devel # if [ -f /usr/sbin/iptables ];then diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index 9d773b754..f652f62f5 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -94,6 +94,7 @@ apt install -y apache2-utils apt install -y numactl apt install -y xxd apt install -y sshpass +apt install -y libbrotli P_VER=`python3 -V | awk '{print $2}'` if version_ge "$P_VER" "3.11.0" ;then diff --git a/scripts/install/euler.sh b/scripts/install/euler.sh index 19720f9c6..44d6fd9f2 100755 --- a/scripts/install/euler.sh +++ b/scripts/install/euler.sh @@ -40,6 +40,7 @@ yum install -y numactl yum install -y sshpass yum install -y libzstd-devel yum install -y postgresql-devel +yum install -y brotli-devel # if [ -f /usr/sbin/iptables ];then diff --git a/scripts/install/fedora.sh b/scripts/install/fedora.sh index c64576c8d..ff402b15b 100644 --- a/scripts/install/fedora.sh +++ b/scripts/install/fedora.sh @@ -20,6 +20,7 @@ yum install -y numactl yum install -y sshpass yum install -y libzstd-devel yum install -y postgresql-devel +yum install -y brotli-devel dnf install crontabs -y SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` diff --git a/scripts/install/freebsd.sh b/scripts/install/freebsd.sh index 09d1624c2..8cc92d3d2 100644 --- a/scripts/install/freebsd.sh +++ b/scripts/install/freebsd.sh @@ -67,7 +67,7 @@ pkg install -y bzip2-devel pkg install -y numactl pkg install -y sshpass pkg install -y libzstd-devel - +pkg install -y brotli-devel # curl https://sh.rustup.rs -sSf | sh pkg install -y rust diff --git a/scripts/install/opensuse.sh b/scripts/install/opensuse.sh index d1190256c..e1196cf8a 100644 --- a/scripts/install/opensuse.sh +++ b/scripts/install/opensuse.sh @@ -61,6 +61,7 @@ zypper install -y libargon2-devel zypper install -y net-tools-deprecated zypper install -y numactl zypper install -y sshpass +zypper install -y brotli-devel # zypper install -y php-config diff --git a/scripts/install/rhel.sh b/scripts/install/rhel.sh index a85c60b8a..a1721e579 100644 --- a/scripts/install/rhel.sh +++ b/scripts/install/rhel.sh @@ -46,6 +46,7 @@ $PKGMGR install -y libncurses* $PKGMGR install -y sshpass $PKGMGR install -y libzstd-devel $PKGMGR install -y postgresql-devel +$PKGMGR install -y brotli-devel echo "install remi source" if [ "$VERSION_ID" == "9" ];then diff --git a/scripts/install/rocky.sh b/scripts/install/rocky.sh index 01ad38d1d..29d19df63 100644 --- a/scripts/install/rocky.sh +++ b/scripts/install/rocky.sh @@ -30,6 +30,7 @@ yum install -y numactl yum install -y sshpass yum install -y libzstd-devel yum install -y postgresql-devel +yum install -y brotli-devel if [ -f /usr/sbin/iptables ];then diff --git a/scripts/install/ubuntu.sh b/scripts/install/ubuntu.sh index 3f1b0c436..37b415b98 100644 --- a/scripts/install/ubuntu.sh +++ b/scripts/install/ubuntu.sh @@ -61,6 +61,7 @@ apt install -y liblz4-tool apt install -y zstd apt install -y sshpass apt install -y libzstd-dev +apt install -y libbrotli P_VER=`python3 -V | awk '{print $2}'` if version_ge "$P_VER" "3.11.0" ;then diff --git a/version/r3.8.txt b/version/r3.8.txt new file mode 100644 index 000000000..0863401ee --- /dev/null +++ b/version/r3.8.txt @@ -0,0 +1,39 @@ +cryptography==36.0.1 +flask==2.0.3 +pyOpenSSL==22.0.0 +requests==2.27.1 +gevent==22.10.2 +gunicorn==21.2.0 +setuptools>=33.1.1 +Werkzeug>=1.0.1,<3.0.0 +wheel>=0.37.1 +requests>=2.27.1 +urllib3>=1.21.1 +flask-session==0.3.2 +flask-helper==0.19 +flask-bcrypt==1.0.1 +flask-caching>=1.10.1 +cache==1.0.3 +gevent-websocket==0.10.1 +psutil==5.9.1 +chardet==3.0.4 +flask-sqlalchemy==2.3.2 +configparser==5.2.0 +python-engineio==4.3.2 +python-socketio>=4.2.0 +flask-socketio==5.2.0 +flask-sockets==0.2.1 +zmq==0.0.0 +paramiko>=2.8.0 +pymongo +pymemcache +redis +pillow +Jinja2>=2.11.2 +PyMySQL==1.0.2 +whitenoise==5.3.0 +pyotp +pytz +pyTelegramBotAPI +telebot +pyyaml \ No newline at end of file diff --git a/version/r3.9.txt b/version/r3.9.txt new file mode 100644 index 000000000..0863401ee --- /dev/null +++ b/version/r3.9.txt @@ -0,0 +1,39 @@ +cryptography==36.0.1 +flask==2.0.3 +pyOpenSSL==22.0.0 +requests==2.27.1 +gevent==22.10.2 +gunicorn==21.2.0 +setuptools>=33.1.1 +Werkzeug>=1.0.1,<3.0.0 +wheel>=0.37.1 +requests>=2.27.1 +urllib3>=1.21.1 +flask-session==0.3.2 +flask-helper==0.19 +flask-bcrypt==1.0.1 +flask-caching>=1.10.1 +cache==1.0.3 +gevent-websocket==0.10.1 +psutil==5.9.1 +chardet==3.0.4 +flask-sqlalchemy==2.3.2 +configparser==5.2.0 +python-engineio==4.3.2 +python-socketio>=4.2.0 +flask-socketio==5.2.0 +flask-sockets==0.2.1 +zmq==0.0.0 +paramiko>=2.8.0 +pymongo +pymemcache +redis +pillow +Jinja2>=2.11.2 +PyMySQL==1.0.2 +whitenoise==5.3.0 +pyotp +pytz +pyTelegramBotAPI +telebot +pyyaml \ No newline at end of file diff --git a/web/core/mw.py b/web/core/mw.py index f588db225..e208b9797 100644 --- a/web/core/mw.py +++ b/web/core/mw.py @@ -1463,7 +1463,19 @@ def checkWebConfig(): result = execShell(cmd) searchStr = 'test is successful' if result[1].find(searchStr) == -1: - msg = getInfo('配置文件错误: {1}', (result[1],)) + msg = getInfo('配置文件错误[openresty]: {1}', (result[1],)) + writeLog("软件管理", msg) + return result[1] + return True + +def checkHttpdConfig(): + op_dir = getServerDir() + '/apache/httpd' + # "ulimit -n 10240 && " + + cmd = op_dir + "/bin/httpd -t" + result = execShell(cmd) + searchStr = 'Syntax OK' + if result[1].find(searchStr) == -1: + msg = getInfo('配置文件错误[httpd]: {1}', (result[1],)) writeLog("软件管理", msg) return result[1] return True