mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 03:09:26 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b71d6b3d7 | ||
|
|
becb7f8c7f | ||
|
|
3da7b57242 | ||
|
|
42e8057356 | ||
|
|
e082baabe8 | ||
|
|
74d565c99a | ||
|
|
750efbf430 | ||
|
|
68112ba978 | ||
|
|
e994375fc8 | ||
|
|
998f677ee7 | ||
|
|
8b1b50938d | ||
|
|
3dbece0b5e | ||
|
|
e9f1e522de | ||
|
|
8a815159c1 | ||
|
|
c8af676d6f | ||
|
|
3bee84a52f | ||
|
|
82828aacf6 | ||
|
|
e4de3cff61 | ||
|
|
4ed7f5d7fd | ||
|
|
7b956c73e4 | ||
|
|
8535dd2306 | ||
|
|
e13df3ae58 | ||
|
|
44fa68f52d | ||
|
|
d72abb1e30 | ||
|
|
aad4343a59 | ||
|
|
6b5717b04f | ||
|
|
655946a467 | ||
|
|
80f3d98162 | ||
|
|
d73be680e2 | ||
|
|
ad9595b3b2 | ||
|
|
8a337fcfd6 | ||
|
|
38b1dba395 | ||
|
|
7195de0418 | ||
|
|
20cb30ba51 | ||
|
|
2a7c96b0f5 | ||
|
|
8503e6ebe9 | ||
|
|
be2c2a2436 | ||
|
|
8a247c93d4 | ||
|
|
b4cdc7fc2d | ||
|
|
cc3f1ed01a | ||
|
|
4db4284362 | ||
|
|
3c2e517c61 | ||
|
|
1d712d1f84 | ||
|
|
f1e1e3c82c | ||
|
|
8e587cf055 | ||
|
|
277b95f74b | ||
|
|
b89b180ee9 | ||
|
|
3e89c35111 | ||
|
|
52f7939b06 | ||
|
|
13d038e855 | ||
|
|
325046d3c2 | ||
|
|
8cb3b578e0 | ||
|
|
3b5a5206fc | ||
|
|
1517d8d2d7 | ||
|
|
ba55477492 | ||
|
|
e363833437 | ||
|
|
6ec51baedb | ||
|
|
0fdf62499b | ||
|
|
1498e23b48 | ||
|
|
106ce839d8 | ||
|
|
eed561dadc | ||
|
|
c97ec1cbba | ||
|
|
29802d8066 | ||
|
|
9a51bc4b4e | ||
|
|
082f697706 | ||
|
|
6e026f2998 | ||
|
|
c647f0c02d | ||
|
|
da99297253 | ||
|
|
4ab982827e | ||
|
|
d3a4db511a | ||
|
|
fa9e4e3b06 | ||
|
|
e7cd941f0f | ||
|
|
c641606ecd | ||
|
|
021a360462 | ||
|
|
9104280ff1 | ||
|
|
0ea0f2d13d | ||
|
|
289e251480 | ||
|
|
ce421cfb89 | ||
|
|
bec41f2c63 | ||
|
|
3a34974ec9 | ||
|
|
a7c9fff283 | ||
|
|
c36cca61a1 | ||
|
|
42edf12d01 | ||
|
|
d6799e89c4 | ||
|
|
4b4006c9da | ||
|
|
33bb042b41 | ||
|
|
be2e91b9ce | ||
|
|
db424f8912 | ||
|
|
bfca2e313a | ||
|
|
1de51747e6 | ||
|
|
8a623b490b | ||
|
|
b5b8ef7e46 | ||
|
|
daa561b6c4 | ||
|
|
9bc30db1ad | ||
|
|
1a9d506d61 | ||
|
|
62b5d812e2 | ||
|
|
433c9ab5ea | ||
|
|
a7a6976204 |
@@ -5,9 +5,9 @@ name: MW APP MySQL55
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -5,9 +5,9 @@ name: MW APP MySQL56
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -5,9 +5,9 @@ name: MW APP MySQL57
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -5,9 +5,9 @@ name: MW APP MySQL80
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -5,9 +5,9 @@ name: MW APP PHP
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
+4
-2
@@ -128,6 +128,7 @@ lib/python*
|
||||
bin
|
||||
pyvenv.cfg
|
||||
include
|
||||
share
|
||||
pip-selfcheck.json
|
||||
|
||||
scripts/mdserver-web
|
||||
@@ -140,16 +141,17 @@ data/restart.pl
|
||||
data/ssl.pl
|
||||
data/edate.pl
|
||||
data/osname.pl
|
||||
data/only_netio_counters.pl
|
||||
data/system.db-journal
|
||||
data/hook_*.json
|
||||
|
||||
plugins/l2tp
|
||||
plugins/openlitespeed
|
||||
plugins/gdrive
|
||||
plugins/mtproxy
|
||||
plugins/zimg
|
||||
plugins/bk_demo
|
||||
debug.out
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
### mdserver-web 0.9.5
|
||||
<p align="center">
|
||||
<img alt="logo" src="https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/logo.png" height="140" />
|
||||
<h3 align="center">mdserver-web</h3>
|
||||
<p align="center">一款简单Linux面板服务</p>
|
||||
</p>
|
||||
|
||||
### 简介
|
||||
|
||||
简单的Linux面板,感谢BT.CN写出如此好的web管理软件。我一看到,就知道这是我一直想要的页面化管理方式。
|
||||
复制了后台管理界面,按照自己想要的方式写了一版。
|
||||
@@ -61,6 +67,15 @@ PHP[53-72]支持phpMyAdmin[4.4.15]
|
||||
PHP[72-81]支持phpMyAdmin[5.2.0]
|
||||
```
|
||||
|
||||
# AD - VPS推荐 - 🙏
|
||||
|
||||
- [ZZZ评测](https://www.zzzvps.com/)
|
||||
|
||||
| 服务商 | LOGO | 推广地址 | 优惠码 |
|
||||
| ------------- |----------|-----------|-------|
|
||||
| digitalvirt |[](https://digitalvirt.com/aff.php?aff=154) | https://digitalvirt.com/aff.php?aff=154 | 9SYDY7UH0U |
|
||||
| 搬瓦工 |[](https://bandwagonhost.com/aff.php?aff=54161) | https://bandwagonhost.com/aff.php?aff=54161 | BWH3HYATVBJW |
|
||||
|
||||
# Docker
|
||||
|
||||
- 由[DDSRem](https://github.com/DDSRem)开发维护。
|
||||
@@ -71,13 +86,18 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
||||
```
|
||||
|
||||
|
||||
### 版本更新 0.9.5
|
||||
### 版本更新 0.9.9
|
||||
|
||||
* 页面更新优化[2].
|
||||
* 修复maridb的用户管理[2].
|
||||
* Gogs初始化提示更人性.
|
||||
* MySQL&&MariaDB修改密码修复.
|
||||
* MySQL&&MariaDB导入修复.
|
||||
* 更换Logo。
|
||||
* 增加amazon linux系统支持。
|
||||
* 修复rsyncd在debian或ubuntu下安装失败问题。
|
||||
* Readme加入一AD。
|
||||
* PHP-YUM|PHP-APT优化[性能调整]。
|
||||
* 优化Gogs使用MySQL的方式。
|
||||
* 配置模板添加一个whmcs。
|
||||
* MySQL和MariaDB无法直接卸载。
|
||||
* OpenResty加入http_realip_module模块。
|
||||
* PHP加入igbinary扩展。
|
||||
|
||||
|
||||
### JSDelivr安装地址
|
||||
@@ -124,16 +144,25 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/qu
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install_dev.sh | bash
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash
|
||||
|
||||
|
||||
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install_dev.sh | bash
|
||||
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/update_dev.sh | bash
|
||||
```
|
||||
|
||||
### 捐赠地址 USDT(TRC20)
|
||||
|
||||
TVbNgrpeGBGZVm5gTLa21ADP7RpnPFhjya
|
||||
|
||||
|
||||
### 微信赞助
|
||||
[](/route/static/img/weixin_zz.jpg)
|
||||
|
||||
[](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/img/weixin_zz.jpg)
|
||||
|
||||
|
||||
### 无图不真相
|
||||
|
||||
[](/route/static/mdw.jpg)
|
||||
|
||||
[](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/mdw.jpg)
|
||||
|
||||
|
||||
### Stargazers over time
|
||||
@@ -143,7 +172,7 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/up
|
||||
|
||||
### 感谢开发赞助
|
||||
|
||||
[](https://digitalvirt.com/)
|
||||
[](https://digitalvirt.com/aff.php?aff=154)
|
||||
|
||||
### 授权许可
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ from flask import request
|
||||
|
||||
class config_api:
|
||||
|
||||
__version = '0.9.5'
|
||||
__version = '0.9.9'
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
+18
-11
@@ -295,9 +295,18 @@ class crontab_api:
|
||||
# 取数据列表
|
||||
def getDataListApi(self):
|
||||
stype = request.form.get('type', '')
|
||||
|
||||
bak_data = []
|
||||
|
||||
if stype == 'sites' or stype == 'databases':
|
||||
hookPath = mw.getPanelDataDir() + "/hook_backup.json"
|
||||
if os.path.exists(hookPath):
|
||||
t = mw.readFile(hookPath)
|
||||
bak_data = json.loads(t)
|
||||
|
||||
if stype == 'databases':
|
||||
db_list = {}
|
||||
db_list['orderOpt'] = []
|
||||
db_list['orderOpt'] = bak_data
|
||||
path = mw.getServerDir() + '/mysql'
|
||||
if not os.path.exists(path + '/mysql.db'):
|
||||
db_list['data'] = []
|
||||
@@ -307,8 +316,9 @@ class crontab_api:
|
||||
return mw.getJson(db_list)
|
||||
|
||||
data = {}
|
||||
data['orderOpt'] = bak_data
|
||||
|
||||
data['data'] = mw.M(stype).field('name,ps').select()
|
||||
data['orderOpt'] = []
|
||||
return mw.getJson(data)
|
||||
##### ----- start ----- ###
|
||||
|
||||
@@ -411,16 +421,13 @@ class crontab_api:
|
||||
'rememory': head + "/bin/bash " + script_dir + '/rememory.sh'
|
||||
}
|
||||
if param['backup_to'] != 'localhost':
|
||||
cfile = mw.getServerDir() + "/mdserver-web/plugin/" + \
|
||||
param['backup_to'] + "/" + param['backup_to'] + "_main.py"
|
||||
if not os.path.exists(cfile):
|
||||
cfile = script_dir + "/backup_" + \
|
||||
param['backup_to'] + ".py"
|
||||
cfile = mw.getPluginDir() + "/" + \
|
||||
param['backup_to'] + "/index.py"
|
||||
wheres = {
|
||||
'path': head + "python " + cfile + " path " + param['sname'] + " " + str(param['save']),
|
||||
'site': head + "python " + cfile + " site " + param['sname'] + " " + str(param['save']),
|
||||
'database': head + "python " + cfile + " database " + param['sname'] + " " + str(param['save']),
|
||||
'logs': head + "python " + script_dir + "/logs_backup.py " + param['sname'] + log + " " + str(param['save']),
|
||||
'path': head + "python3 " + cfile + " path " + param['sname'] + " " + str(param['save']),
|
||||
'site': head + "python3 " + cfile + " site " + param['sname'] + " " + str(param['save']),
|
||||
'database': head + "python3 " + cfile + " database " + param['sname'] + " " + str(param['save']),
|
||||
'logs': head + "python3 " + script_dir + "/logs_backup.py " + param['sname'] + log + " " + str(param['save']),
|
||||
'rememory': head + "/bin/bash " + script_dir + '/rememory.sh'
|
||||
}
|
||||
try:
|
||||
|
||||
@@ -676,8 +676,7 @@ class files_api:
|
||||
data['encoding'] = 'utf-8'
|
||||
if char['encoding'] == 'Big5':
|
||||
data['encoding'] = 'BIG5'
|
||||
if not char['encoding'] in ['GBK', 'utf-8',
|
||||
'BIG5']:
|
||||
if not char['encoding'] in ['GBK', 'utf-8', 'BIG5']:
|
||||
data['encoding'] = 'utf-8'
|
||||
try:
|
||||
if sys.version_info[0] == 2:
|
||||
|
||||
+21
-17
@@ -57,10 +57,22 @@ def getPluginDir():
|
||||
return getRunDir() + '/plugins'
|
||||
|
||||
|
||||
def getPanelDataDir():
|
||||
return getRunDir() + '/data'
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return getRootDir() + '/server'
|
||||
|
||||
|
||||
def getLogsDir():
|
||||
return getRootDir() + '/wwwlogs'
|
||||
|
||||
|
||||
def getBackupDir():
|
||||
return getRootDir() + '/backup'
|
||||
|
||||
|
||||
def getWwwDir():
|
||||
file = getRunDir() + '/data/site.pl'
|
||||
if os.path.exists(file):
|
||||
@@ -73,14 +85,6 @@ def setWwwDir(wdir):
|
||||
return writeFile(file, wdir)
|
||||
|
||||
|
||||
def getLogsDir():
|
||||
return getRootDir() + '/wwwlogs'
|
||||
|
||||
|
||||
def getBackupDir():
|
||||
return getRootDir() + '/backup'
|
||||
|
||||
|
||||
def setBackupDir(bdir):
|
||||
file = getRunDir() + '/data/backup.pl'
|
||||
return writeFile(file, bdir)
|
||||
@@ -646,16 +650,14 @@ def getLocalIp():
|
||||
try:
|
||||
ipaddress = readFile(filename)
|
||||
if not ipaddress or ipaddress == '127.0.0.1':
|
||||
raise Exception("ip is empty!")
|
||||
cmd = "curl -4 -sS --connect-timeout 5 -m 60 https://v6r.ipip.net/?format=text"
|
||||
ip = execShell(cmd)
|
||||
result = ip[0].strip()
|
||||
if result == '':
|
||||
raise Exception("ipv4 is empty!")
|
||||
writeFile(filename, result)
|
||||
return result
|
||||
return ipaddress
|
||||
except Exception as e:
|
||||
cmd = "curl -4 -sS --connect-timeout 5 -m 60 https://v6r.ipip.net/?format=text"
|
||||
ip = execShell(cmd)
|
||||
result = ip[0].strip()
|
||||
if result == '':
|
||||
raise e
|
||||
writeFile(filename, result)
|
||||
return result
|
||||
except Exception as e:
|
||||
cmd = "curl -6 -sS --connect-timeout 5 -m 60 https://v6r.ipip.net/?format=text"
|
||||
ip = execShell(cmd)
|
||||
@@ -664,6 +666,8 @@ def getLocalIp():
|
||||
return '127.0.0.1'
|
||||
writeFile(filename, result)
|
||||
return result
|
||||
finally:
|
||||
pass
|
||||
return '127.0.0.1'
|
||||
|
||||
|
||||
|
||||
@@ -114,6 +114,7 @@ class plugins_api:
|
||||
return mw.returnJson(False, '配置文件不存在!', ())
|
||||
|
||||
pluginInfo = json.loads(mw.readFile(infoJsonPos))
|
||||
self.hookInstall(pluginInfo)
|
||||
|
||||
execstr = "cd " + os.getcwd() + "/plugins/" + \
|
||||
name + " && /bin/bash " + pluginInfo["shell"] \
|
||||
@@ -131,6 +132,55 @@ class plugins_api:
|
||||
mw.triggerTask()
|
||||
return mw.returnJson(True, '已将安装任务添加到队列!')
|
||||
|
||||
def hookInstallFile(self, hook_name, info):
|
||||
hookPath = mw.getPanelDataDir() + "/hook_" + hook_name + ".json"
|
||||
data = []
|
||||
if os.path.exists(hookPath):
|
||||
t = mw.readFile(hookPath)
|
||||
data = json.loads(t)
|
||||
|
||||
isNeedAdd = True
|
||||
for x in range(len(data)):
|
||||
if data[x]['title'] == info['title'] and data[x]['name'] == info['name']:
|
||||
isNeedAdd = False
|
||||
|
||||
if isNeedAdd:
|
||||
tmp = {}
|
||||
tmp['title'] = info['title']
|
||||
tmp['name'] = info['name']
|
||||
data.append(tmp)
|
||||
mw.writeFile(hookPath, json.dumps(data))
|
||||
|
||||
def hookUninstallFile(self, hook_name, info):
|
||||
hookPath = mw.getPanelDataDir() + "/hook_" + hook_name + ".json"
|
||||
data = []
|
||||
if os.path.exists(hookPath):
|
||||
t = mw.readFile(hookPath)
|
||||
data = json.loads(t)
|
||||
|
||||
for idx in range(len(data)):
|
||||
if data[idx]['title'] == info['title'] and data[idx]['name'] == info['name']:
|
||||
data.remove(data[idx])
|
||||
mw.writeFile(hookPath, json.dumps(data))
|
||||
|
||||
def hookInstall(self, info):
|
||||
if 'hook' in info:
|
||||
hooks = info['hook']
|
||||
for x in hooks:
|
||||
if x in ['backup']:
|
||||
self.hookInstallFile(x, info)
|
||||
return True
|
||||
return False
|
||||
|
||||
def hookUninstall(self, info):
|
||||
if 'hook' in info:
|
||||
hooks = info['hook']
|
||||
for x in hooks:
|
||||
if x in ['backup']:
|
||||
self.hookUninstallFile(x, info)
|
||||
return True
|
||||
return False
|
||||
|
||||
def uninstallOldApi(self):
|
||||
rundir = mw.getRunDir()
|
||||
name = request.form.get('name', '')
|
||||
@@ -147,7 +197,6 @@ class plugins_api:
|
||||
return mw.returnJson(False, "配置文件不存在!", ())
|
||||
|
||||
pluginInfo = json.loads(mw.readFile(infoJsonPos))
|
||||
|
||||
execstr = "cd " + os.getcwd() + "/plugins/" + \
|
||||
name + " && /bin/bash " + pluginInfo["shell"] \
|
||||
+ " uninstall " + version
|
||||
@@ -175,13 +224,13 @@ class plugins_api:
|
||||
return mw.returnJson(False, "配置文件不存在!", ())
|
||||
|
||||
pluginInfo = json.loads(mw.readFile(infoJsonPos))
|
||||
|
||||
self.hookUninstall(pluginInfo)
|
||||
execstr = "cd " + os.getcwd() + "/plugins/" + \
|
||||
name + " && /bin/bash " + pluginInfo["shell"] \
|
||||
+ " uninstall " + version
|
||||
|
||||
data = mw.execShell(execstr)
|
||||
if mw.isAppleSystem():
|
||||
if mw.isDebugMode():
|
||||
print(execstr)
|
||||
print(data[0], data[1])
|
||||
self.removeIndex(name, version)
|
||||
@@ -793,7 +842,7 @@ class plugins_api:
|
||||
print('getIndexList:', e)
|
||||
|
||||
# 使用gevent模式时,无法使用多进程
|
||||
#plist = self.checkStatusMProcess(plist)
|
||||
# plist = self.checkStatusMProcess(plist)
|
||||
plist = self.checkStatusMThreads(plist)
|
||||
return plist
|
||||
|
||||
|
||||
@@ -497,7 +497,7 @@ class site_api:
|
||||
certName = request.form.get('certName', '')
|
||||
siteName = request.form.get('siteName', '')
|
||||
try:
|
||||
path = self.sslDir + siteName
|
||||
path = self.sslDir + siteName.strip()
|
||||
if not os.path.exists(path):
|
||||
return mw.returnJson(False, '证书不存在!')
|
||||
|
||||
|
||||
+38
-35
@@ -437,12 +437,35 @@ class system_api:
|
||||
os.system('echo > /tmp/panelBoot.pl')
|
||||
return total, count
|
||||
|
||||
def psutilNetIoCounters(self):
|
||||
'''
|
||||
统计网卡流量
|
||||
'''
|
||||
stat_pl = 'data/only_netio_counters.pl'
|
||||
if os.path.exists(stat_pl):
|
||||
local_lo = (0, 0, 0, 0)
|
||||
ioName = psutil.net_io_counters(pernic=True).keys()
|
||||
for x in ioName:
|
||||
|
||||
if x.find("lo") > -1:
|
||||
local_lo = psutil.net_io_counters(
|
||||
pernic=True).get(x)[:4]
|
||||
|
||||
all_io = psutil.net_io_counters()[:4]
|
||||
result_io = tuple([all_io[i] - local_lo[i]
|
||||
for i in range(0, len(all_io))])
|
||||
|
||||
# print(local_lo)
|
||||
# print(all_io)
|
||||
# print(result_io)
|
||||
return result_io
|
||||
return psutil.net_io_counters()[:4]
|
||||
|
||||
def getNetWork(self):
|
||||
# return self.GetNetWorkApi(get);
|
||||
# 取网络流量信息
|
||||
try:
|
||||
# 取网络流量信息
|
||||
networkIo = psutil.net_io_counters()[:4]
|
||||
networkIo = self.psutilNetIoCounters()
|
||||
if not "otime" in session:
|
||||
session['up'] = networkIo[0]
|
||||
session['down'] = networkIo[1]
|
||||
@@ -470,38 +493,7 @@ class system_api:
|
||||
|
||||
return networkInfo
|
||||
except Exception as e:
|
||||
# print(e)
|
||||
return None
|
||||
|
||||
def getNetWorkApi(self):
|
||||
# 取网络流量信息
|
||||
try:
|
||||
tmpfile = 'data/network.temp'
|
||||
networkIo = psutil.net_io_counters()[:4]
|
||||
|
||||
if not os.path.exists(tmpfile):
|
||||
mw.writeFile(tmpfile, str(
|
||||
networkIo[0]) + '|' + str(networkIo[1]) + '|' + str(int(time.time())))
|
||||
|
||||
lastValue = mw.readFile(tmpfile).split('|')
|
||||
|
||||
ntime = time.time()
|
||||
networkInfo = {}
|
||||
networkInfo['upTotal'] = networkIo[0]
|
||||
networkInfo['downTotal'] = networkIo[1]
|
||||
networkInfo['up'] = round(
|
||||
float(networkIo[0] - int(lastValue[0])) / 1024 / (ntime - int(lastValue[2])), 2)
|
||||
networkInfo['down'] = round(
|
||||
float(networkIo[1] - int(lastValue[1])) / 1024 / (ntime - int(lastValue[2])), 2)
|
||||
networkInfo['downPackets'] = networkIo[3]
|
||||
networkInfo['upPackets'] = networkIo[2]
|
||||
|
||||
mw.writeFile(tmpfile, str(
|
||||
networkIo[0]) + '|' + str(networkIo[1]) + '|' + str(int(time.time())))
|
||||
|
||||
# networkInfo['cpu'] = self.GetCpuInfo(0.1)
|
||||
return networkInfo
|
||||
except:
|
||||
print("getNetWork error:", e)
|
||||
return None
|
||||
|
||||
def getNetWorkIoData(self, start, end):
|
||||
@@ -567,14 +559,19 @@ class system_api:
|
||||
def setControl(self, stype, day):
|
||||
|
||||
filename = 'data/control.conf'
|
||||
stat_pl = 'data/only_netio_counters.pl'
|
||||
|
||||
if stype == '0':
|
||||
mw.execShell("rm -f " + filename)
|
||||
mw.execShell("rm -rf " + filename)
|
||||
elif stype == '1':
|
||||
_day = int(day)
|
||||
if _day < 1:
|
||||
return mw.returnJson(False, "设置失败!")
|
||||
mw.writeFile(filename, day)
|
||||
elif stype == '2':
|
||||
mw.execShell("rm -rf " + stat_pl)
|
||||
elif stype == '3':
|
||||
mw.execShell("echo 'True' > " + stat_pl)
|
||||
elif stype == 'del':
|
||||
if not mw.isRestart():
|
||||
return mw.returnJson(False, '请等待所有安装任务完成再执行')
|
||||
@@ -597,6 +594,12 @@ class system_api:
|
||||
else:
|
||||
data['day'] = 30
|
||||
data['status'] = False
|
||||
|
||||
if os.path.exists(stat_pl):
|
||||
data['stat_all_status'] = True
|
||||
else:
|
||||
data['stat_all_status'] = False
|
||||
|
||||
return mw.getJson(data)
|
||||
|
||||
return mw.returnJson(True, "设置成功!")
|
||||
|
||||
@@ -68,6 +68,9 @@ class ORM:
|
||||
def setPort(self, port):
|
||||
self.__DB_PORT = port
|
||||
|
||||
def setUser(self, user):
|
||||
self.__DB_USER = user
|
||||
|
||||
def setPwd(self, pwd):
|
||||
self.__DB_PASS = pwd
|
||||
|
||||
|
||||
@@ -77,6 +77,12 @@ class ORM:
|
||||
def getPwd(self):
|
||||
return self.__DB_PASS
|
||||
|
||||
def setDbName(self, name):
|
||||
self.__DB_NAME = name
|
||||
|
||||
def setUser(self, user):
|
||||
self.__DB_USER = user
|
||||
|
||||
def execute(self, sql):
|
||||
# 执行SQL语句返回受影响行
|
||||
if not self.__Conn():
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
# coding: utf-8
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
# sys.path.append("/usr/local/lib/python3.6/site-packages")
|
||||
|
||||
|
||||
class mysqlDb:
|
||||
__DB_PASS = None
|
||||
__DB_USER = 'root'
|
||||
__DB_PORT = 3306
|
||||
__DB_HOST = 'localhost'
|
||||
__DB_NAME = 'test'
|
||||
__DB_CONN = None
|
||||
__DB_CUR = None
|
||||
__DB_ERR = None
|
||||
__DB_CNF = '/etc/my.cnf'
|
||||
|
||||
def __Conn(self):
|
||||
'''连接MYSQL数据库'''
|
||||
try:
|
||||
socket = '/www/server/mysql/mysql.sock'
|
||||
try:
|
||||
import MySQLdb
|
||||
except Exception as ex:
|
||||
self.__DB_ERR = ex
|
||||
return False
|
||||
try:
|
||||
self.__DB_CONN = MySQLdb.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
port=self.__DB_PORT, db=self.__DB_NAME, charset="utf8", connect_timeout=10, unix_socket=socket)
|
||||
except MySQLdb.Error as e:
|
||||
self.__DB_HOST = '127.0.0.1'
|
||||
self.__DB_CONN = MySQLdb.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
port=self.__DB_PORT, db=self.__DB_NAME, charset="utf8", connect_timeout=10, unix_socket=socket)
|
||||
self.__DB_CUR = self.__DB_CONN.cursor()
|
||||
return True
|
||||
|
||||
except MySQLdb.Error as e:
|
||||
self.__DB_ERR = e
|
||||
return False
|
||||
|
||||
def setHost(self, host):
|
||||
self.__DB_HOST = host
|
||||
|
||||
def setPwd(self, pwd):
|
||||
self.__DB_PASS = pwd
|
||||
|
||||
def setUser(self, user):
|
||||
self.__DB_USER = user
|
||||
|
||||
def setPort(self, port):
|
||||
self.__DB_PORT = port
|
||||
|
||||
def setDb(self, name):
|
||||
self.__DB_NAME = name
|
||||
|
||||
def getPwd(self):
|
||||
return self.__DB_PASS
|
||||
|
||||
def execute(self, sql):
|
||||
# 执行SQL语句返回受影响行
|
||||
if not self.__Conn():
|
||||
return self.__DB_ERR
|
||||
try:
|
||||
result = self.__DB_CUR.execute(sql)
|
||||
self.__DB_CONN.commit()
|
||||
self.__Close()
|
||||
return result
|
||||
except Exception as ex:
|
||||
return ex
|
||||
|
||||
def query(self, sql):
|
||||
# 执行SQL语句返回数据集
|
||||
if not self.__Conn():
|
||||
return self.__DB_ERR
|
||||
try:
|
||||
self.__DB_CUR.execute(sql)
|
||||
result = self.__DB_CUR.fetchall()
|
||||
# 将元组转换成列表
|
||||
# data = map(list, result)
|
||||
self.__Close()
|
||||
return result
|
||||
except Exception as ex:
|
||||
return "error: " + str(ex)
|
||||
|
||||
# 关闭连接
|
||||
def __Close(self):
|
||||
self.__DB_CUR.close()
|
||||
self.__DB_CONN.close()
|
||||
+12
-12
@@ -31,9 +31,6 @@ def getPluginName():
|
||||
def getPluginDir():
|
||||
return mw.getPluginDir() + '/' + getPluginName()
|
||||
|
||||
sys.path.append(getPluginDir() + "/class")
|
||||
import mysqlDb
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return mw.getServerDir() + '/' + getPluginName()
|
||||
@@ -235,16 +232,19 @@ def getDbConfValue():
|
||||
|
||||
|
||||
def pMysqlDb(conf):
|
||||
|
||||
host = conf['HOST'].split(':')
|
||||
conn = mysqlDb.mysqlDb()
|
||||
# pymysql
|
||||
db = mw.getMyORM()
|
||||
# MySQLdb |
|
||||
# db = mw.getMyORMDb()
|
||||
|
||||
conn.setHost(host[0])
|
||||
conn.setUser(conf['USER'])
|
||||
conn.setPwd(conf['PASSWD'])
|
||||
conn.setPort(int(host[1]))
|
||||
conn.setDb(conf['NAME'])
|
||||
return conn
|
||||
db.setPort(int(host[1]))
|
||||
db.setUser(conf['USER'])
|
||||
db.setPwd(conf['PASSWD'])
|
||||
db.setDbName(conf['NAME'])
|
||||
# db.setSocket(getSocketFile())
|
||||
db.setCharset("utf8")
|
||||
return db
|
||||
|
||||
|
||||
def pSqliteDb(conf):
|
||||
@@ -476,7 +476,7 @@ def userList():
|
||||
|
||||
start = (page - 1) * page_size
|
||||
list_count = pQuery('select count(id) as num from user')
|
||||
count = list_count[0][0]
|
||||
count = list_count[0]["num"]
|
||||
list_data = pQuery(
|
||||
'select id,name,email from user order by id desc limit ' + str(start) + ',' + str(page_size))
|
||||
data['list'] = mw.getPage({'count': count, 'p': page,
|
||||
|
||||
@@ -29,6 +29,8 @@ getBit(){
|
||||
|
||||
Install_gogs()
|
||||
{
|
||||
pip3 install mysqlclient
|
||||
|
||||
mkdir -p $serverPath/source/gogs
|
||||
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
@@ -163,11 +163,11 @@ function gogsUserList(page, search) {
|
||||
|
||||
ulist = rdata['data']['data'];
|
||||
for (i in ulist){
|
||||
email = ulist[i][2] == '' ? '无' : ulist[i][2];
|
||||
content += '<tr><td>'+ulist[i][0]+'</td>'+
|
||||
'<td>'+ulist[i][1]+'</td>'+
|
||||
email = ulist[i]["email"] == '' ? '无' : ulist[i]["email"];
|
||||
content += '<tr><td>'+ulist[i]["id"]+'</td>'+
|
||||
'<td>'+ulist[i]["name"]+'</td>'+
|
||||
'<td>'+email+'</td>'+
|
||||
'<td><a class="btlink" onclick="userProjectList(\''+ulist[i][1]+'\')">项目管理</a></td>'+
|
||||
'<td><a class="btlink" onclick="userProjectList(\''+ulist[i]["name"]+'\')">项目管理</a></td>'+
|
||||
'</tr>';
|
||||
}
|
||||
|
||||
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
global
|
||||
daemon
|
||||
log 127.0.0.1 local0
|
||||
pidfile /tmp/haproxy.pid
|
||||
maxconn 4000
|
||||
user haproxy
|
||||
group haproxy
|
||||
|
||||
|
||||
defaults
|
||||
mode http
|
||||
log global
|
||||
option httplog
|
||||
timeout connect 10s
|
||||
timeout client 15s
|
||||
timeout server 15s
|
||||
|
||||
|
||||
listen stats
|
||||
mode http
|
||||
bind *:10800
|
||||
stats enable
|
||||
stats uri /haproxy
|
||||
stats realm Haproxy\ Statistics
|
||||
stats auth admin:admin
|
||||
|
||||
frontend http-in
|
||||
bind *:1080
|
||||
default_backend servers
|
||||
option forwardfor
|
||||
option httpclose
|
||||
|
||||
backend servers
|
||||
balance roundrobin
|
||||
server web1 0.0.0.0:9090 check
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
Executable
+18
@@ -0,0 +1,18 @@
|
||||
<div class="bt-form">
|
||||
<div class="bt-w-main">
|
||||
<div class="bt-w-menu">
|
||||
<p class="bgw" onclick="pluginService('haproxy');">服务</p>
|
||||
<p onclick="pluginInitD('haproxy');">自启动</p>
|
||||
<p onclick="pluginConfigTpl('haproxy');">配置修改</p>
|
||||
<p onclick="pluginLogs('haproxy','','run_log',30);">运行日志</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
<div class="soft-man-con"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$.getScript( "/plugins/file?name=haproxy&f=js/haproxy.js", function(){
|
||||
pluginService('haproxy');
|
||||
});
|
||||
</script>
|
||||
Executable
+253
@@ -0,0 +1,253 @@
|
||||
# coding:utf-8
|
||||
|
||||
import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import re
|
||||
import string
|
||||
import subprocess
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import mw
|
||||
|
||||
app_debug = False
|
||||
if mw.isAppleSystem():
|
||||
app_debug = True
|
||||
|
||||
|
||||
def getPluginName():
|
||||
return 'haproxy'
|
||||
|
||||
|
||||
def getPluginDir():
|
||||
return mw.getPluginDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return mw.getServerDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getInitDFile():
|
||||
if app_debug:
|
||||
return '/tmp/' + getPluginName()
|
||||
return '/etc/init.d/' + getPluginName()
|
||||
|
||||
|
||||
def getConfTpl():
|
||||
path = getPluginDir() + "/conf/haproxy.conf"
|
||||
return path
|
||||
|
||||
|
||||
def getConf():
|
||||
path = getServerDir() + "/haproxy.conf"
|
||||
return path
|
||||
|
||||
|
||||
def getInitDTpl():
|
||||
path = getPluginDir() + "/init.d/" + getPluginName() + ".tpl"
|
||||
return path
|
||||
|
||||
|
||||
def getArgs():
|
||||
args = sys.argv[2:]
|
||||
tmp = {}
|
||||
args_len = len(args)
|
||||
|
||||
if args_len == 1:
|
||||
t = args[0].strip('{').strip('}')
|
||||
t = t.split(':')
|
||||
tmp[t[0]] = t[1]
|
||||
elif args_len > 1:
|
||||
for i in range(len(args)):
|
||||
t = args[i].split(':')
|
||||
tmp[t[0]] = t[1]
|
||||
return tmp
|
||||
|
||||
|
||||
def checkArgs(data, ck=[]):
|
||||
for i in range(len(ck)):
|
||||
if not ck[i] in data:
|
||||
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
|
||||
return (True, mw.returnJson(True, 'ok'))
|
||||
|
||||
|
||||
def configTpl():
|
||||
path = getPluginDir() + '/tpl'
|
||||
pathFile = os.listdir(path)
|
||||
tmp = []
|
||||
for one in pathFile:
|
||||
file = path + '/' + one
|
||||
tmp.append(file)
|
||||
return mw.getJson(tmp)
|
||||
|
||||
|
||||
def readConfigTpl():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['file'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
content = mw.readFile(args['file'])
|
||||
content = contentReplace(content)
|
||||
return mw.returnJson(True, 'ok', content)
|
||||
|
||||
|
||||
def contentReplace(content):
|
||||
service_path = mw.getServerDir()
|
||||
content = content.replace('{$ROOT_PATH}', mw.getRootDir())
|
||||
content = content.replace('{$SERVER_PATH}', service_path)
|
||||
content = content.replace('{$SERVER_APP}', service_path + '/haproxy')
|
||||
return content
|
||||
|
||||
|
||||
def status():
|
||||
data = mw.execShell(
|
||||
"ps -ef|grep haproxy |grep -v grep | grep -v python | awk '{print $2}'")
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
return 'start'
|
||||
|
||||
|
||||
def initDreplace():
|
||||
|
||||
file_tpl = getInitDTpl()
|
||||
service_path = os.path.dirname(os.getcwd())
|
||||
|
||||
initD_path = getServerDir() + '/init.d'
|
||||
if not os.path.exists(initD_path):
|
||||
os.mkdir(initD_path)
|
||||
file_bin = initD_path + '/' + getPluginName()
|
||||
|
||||
# initd replace
|
||||
if not os.path.exists(file_bin):
|
||||
content = mw.readFile(file_tpl)
|
||||
content = contentReplace(content)
|
||||
mw.writeFile(file_bin, content)
|
||||
mw.execShell('chmod +x ' + file_bin)
|
||||
|
||||
# config replace
|
||||
conf_bin = getConf()
|
||||
if not os.path.exists(conf_bin):
|
||||
conf_content = mw.readFile(getConfTpl())
|
||||
conf_content = contentReplace(conf_content)
|
||||
mw.writeFile(getServerDir() + '/haproxy.conf', conf_content)
|
||||
|
||||
# systemd
|
||||
systemDir = mw.systemdCfgDir()
|
||||
systemService = systemDir + '/haproxy.service'
|
||||
systemServiceTpl = getPluginDir() + '/init.d/haproxy.service.tpl'
|
||||
if os.path.exists(systemDir) and not os.path.exists(systemService):
|
||||
service_path = mw.getServerDir()
|
||||
se_content = mw.readFile(systemServiceTpl)
|
||||
se_content = se_content.replace('{$SERVER_PATH}', service_path)
|
||||
mw.writeFile(systemService, se_content)
|
||||
mw.execShell('systemctl daemon-reload')
|
||||
|
||||
return file_bin
|
||||
|
||||
|
||||
def haOp(method):
|
||||
file = initDreplace()
|
||||
|
||||
if not mw.isAppleSystem():
|
||||
data = mw.execShell('systemctl ' + method + ' haproxy')
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
|
||||
data = mw.execShell(file + ' ' + method)
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
|
||||
|
||||
def start():
|
||||
return haOp('start')
|
||||
|
||||
|
||||
def stop():
|
||||
return haOp('stop')
|
||||
|
||||
|
||||
def restart():
|
||||
return haOp('restart')
|
||||
|
||||
|
||||
def reload():
|
||||
return haOp('reload')
|
||||
|
||||
|
||||
def initdStatus():
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
shell_cmd = 'systemctl status haproxy | grep loaded | grep "enabled;"'
|
||||
data = mw.execShell(shell_cmd)
|
||||
if data[0] == '':
|
||||
return 'fail'
|
||||
return 'ok'
|
||||
|
||||
|
||||
def initdInstall():
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
mw.execShell('systemctl enable haproxy')
|
||||
return 'ok'
|
||||
|
||||
|
||||
def initdUinstall():
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
mw.execShell('systemctl disable haproxy')
|
||||
return 'ok'
|
||||
|
||||
|
||||
def runLog():
|
||||
path = getConf()
|
||||
content = mw.readFile(path)
|
||||
rep = 'log\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0]
|
||||
|
||||
|
||||
def getPort():
|
||||
path = getConf()
|
||||
content = mw.readFile(path)
|
||||
rep = 'listen\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
if func == 'status':
|
||||
print(status())
|
||||
elif func == 'start':
|
||||
print(start())
|
||||
elif func == 'stop':
|
||||
print(stop())
|
||||
elif func == 'restart':
|
||||
print(restart())
|
||||
elif func == 'reload':
|
||||
print(reload())
|
||||
elif func == 'initd_status':
|
||||
print(initdStatus())
|
||||
elif func == 'initd_install':
|
||||
print(initdInstall())
|
||||
elif func == 'initd_uninstall':
|
||||
print(initdUinstall())
|
||||
elif func == 'conf':
|
||||
print(getConf())
|
||||
elif func == 'config_tpl':
|
||||
print(configTpl())
|
||||
elif func == 'read_config_tpl':
|
||||
print(readConfigTpl())
|
||||
elif func == 'run_log':
|
||||
print(runLog())
|
||||
elif func == 'query_log':
|
||||
print(queryLog())
|
||||
else:
|
||||
print('error')
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"sort": 7,
|
||||
"ps": "可靠、高性能的TCP/HTTP负载平衡器",
|
||||
"name": "haproxy",
|
||||
"title": "haproxy",
|
||||
"shell": "install.sh",
|
||||
"versions":["2.6"],
|
||||
"updates":["2.6"],
|
||||
"tip": "soft",
|
||||
"checks": "server/haproxy",
|
||||
"path": "server/haproxy",
|
||||
"display": 1,
|
||||
"author": "midoks",
|
||||
"date": "2022-08-26",
|
||||
"home": "https://www.haproxy.org/",
|
||||
"doc1": "https://www.haproxy.org/",
|
||||
"type": 0,
|
||||
"pid": "4"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=he Reliable, High Performance TCP/HTTP Load Balancer
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStartPre={$SERVER_PATH}/haproxy/sbin/haproxy -c -f {$SERVER_PATH}/haproxy/haproxy.conf
|
||||
ExecStart={$SERVER_PATH}/haproxy/sbin/haproxy -D -f {$SERVER_PATH}/haproxy/haproxy.conf
|
||||
ExecReload={$SERVER_PATH}/haproxy/sbin/haproxy -f {$SERVER_PATH}/haproxy/haproxy.conf -c -q
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,119 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# chkconfig: - 85 15
|
||||
# description: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited \
|
||||
# for high availability environments.
|
||||
# processname: haproxy
|
||||
# config: /etc/haproxy/haproxy.cfg
|
||||
# pidfile: /var/run/haproxy.pid
|
||||
# Script Author: Simon Matter <simon.matter@invoca.ch>
|
||||
# Version: 2004060600
|
||||
# Source function library.
|
||||
|
||||
if [ -f /etc/init.d/functions ]; then
|
||||
. /etc/init.d/functions
|
||||
elif [ -f /etc/rc.d/init.d/functions ] ; then
|
||||
. /etc/rc.d/init.d/functions
|
||||
else
|
||||
echo ".."
|
||||
fi
|
||||
|
||||
# Source networking configuration.
|
||||
if [ -f /etc/sysconfig/network ];then
|
||||
. /etc/sysconfig/network
|
||||
fi
|
||||
|
||||
# Check that networking is up.
|
||||
# [ ${NETWORKING} = "no" ] && exit 0
|
||||
|
||||
HAPROXYDIR={$SERVER_PATH}/haproxy
|
||||
BASENAME=haproxy
|
||||
|
||||
# This is our service name
|
||||
|
||||
#BASENAME=`basename $0`
|
||||
#if [ -L $0 ]; then
|
||||
# BASENAME=`find $0 -name $BASENAME -printf %l`
|
||||
# BASENAME=`basename $BASENAME`
|
||||
#fi
|
||||
|
||||
[ -f $HAPROXYDIR/etc/$BASENAME.conf ] || exit 1
|
||||
|
||||
RETVAL=0
|
||||
|
||||
start() {
|
||||
$HAPROXYDIR/sbin/$BASENAME -c -q -f $HAPROXYDIR/etc/$BASENAME.conf
|
||||
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Errors found in configuration file, check it with '$BASENAME check'."
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -n "Starting $BASENAME: "
|
||||
daemon $HAPROXYDIR/sbin/$BASENAME -D -f $HAPROXYDIR/etc/$BASENAME.conf
|
||||
RETVAL=$?
|
||||
# echo
|
||||
# [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$BASENAME
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
|
||||
stop() {
|
||||
|
||||
echo -n "Shutting down $BASENAME: "
|
||||
killproc $BASENAME -USR1
|
||||
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$BASENAME
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/run/$BASENAME.pid
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
restart() {
|
||||
$HAPROXYDIR/sbin/$BASENAME -c -q -f $HAPROXYDIR/etc/$BASENAME.conf
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Errors found in configuration file, check it with '$BASENAME check'."
|
||||
return 1
|
||||
fi
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
$HAPROXYDIR/sbin/$BASENAME -c -q -f $HAPROXYDIR/etc/$BASENAME.conf
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Errors found in configuration file, check it with '$BASENAME check'."
|
||||
return 1
|
||||
fi
|
||||
$HAPROXYDIR/sbin/$BASENAME -D -f $HAPROXYDIR/$BASENAME.conf -p /var/run/$BASENAME.pid -sf $(cat /var/run/$BASENAME.pid)
|
||||
}
|
||||
|
||||
check() {
|
||||
$HAPROXYDIR/sbin/$BASENAME -c -q -V -f $HAPROXYDIR/etc/$BASENAME.conf
|
||||
}
|
||||
|
||||
rhstatus() {
|
||||
status $BASENAME
|
||||
}
|
||||
|
||||
condrestart() {
|
||||
[ -e /var/lock/subsys/$BASENAME ] && restart || :
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start) start ;;
|
||||
stop) stop ;;
|
||||
restart) restart;;
|
||||
reload) reload;;
|
||||
condrestart) condrestart ;;
|
||||
status) rhstatus ;;
|
||||
check) check ;;
|
||||
*)
|
||||
echo $"Usage: $BASENAME {start|stop|restart|reload|condrestart|status|check}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/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")
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
action=$1
|
||||
type=$2
|
||||
|
||||
echo $action $type
|
||||
|
||||
if id haproxy &> /dev/null ;then
|
||||
echo "haproxy UID is `id -u haproxy`"
|
||||
echo "haproxy Shell is `grep "^haproxy:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd haproxy
|
||||
useradd -g haproxy haproxy
|
||||
fi
|
||||
|
||||
if [ "${2}" == "" ];then
|
||||
echo '缺少安装脚本...' > $install_tmp
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -d $curPath/versions/$2 ];then
|
||||
echo '缺少安装脚本2...' > $install_tmp
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${action}" == "uninstall" ];then
|
||||
|
||||
if [ -f /usr/lib/systemd/system/haproxy.service ] || [ -f /lib/systemd/system/haproxy.service ];then
|
||||
systemctl stop haproxy
|
||||
systemctl disable haproxy
|
||||
rm -rf /usr/lib/systemd/system/haproxy.service
|
||||
rm -rf /lib/systemd/system/haproxy.service
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
fi
|
||||
|
||||
sh -x $curPath/versions/$2/install.sh $1
|
||||
|
||||
if [ "${action}" == "install" ] && [ -d $serverPath/haproxy ];then
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/haproxy/index.py start ${type}
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/haproxy/index.py initd_install ${type}
|
||||
fi
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
function spPostMin(method, args, callback){
|
||||
|
||||
var req_data = {};
|
||||
req_data['name'] = 'haproxy';
|
||||
req_data['func'] = method;
|
||||
|
||||
if (typeof(args) != 'undefined' && args!=''){
|
||||
req_data['args'] = JSON.stringify(args);
|
||||
}
|
||||
|
||||
$.post('/plugins/run', req_data, function(data) {
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
function spPost(method, args, callback){
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
spPostMin(method,args,function(data){
|
||||
layer.close(loadT);
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function secToTime(s) {
|
||||
var t;
|
||||
if(s > -1){
|
||||
var hour = Math.floor(s/3600);
|
||||
var min = Math.floor(s/60) % 60;
|
||||
var sec = s % 60;
|
||||
if(hour < 10) {
|
||||
t = '0'+ hour + ":";
|
||||
} else {
|
||||
t = hour + ":";
|
||||
}
|
||||
|
||||
if(min < 10){t += "0";}
|
||||
t += min + ":";
|
||||
if(sec < 10){t += "0";}
|
||||
t += sec.toFixed(2);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/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`
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
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.6.4
|
||||
MIN_VERSION=2.6
|
||||
Install_App()
|
||||
{
|
||||
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
mkdir -p $serverPath/haproxy
|
||||
|
||||
APP_DIR=${serverPath}/source/haproxy
|
||||
mkdir -p $APP_DIR
|
||||
|
||||
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
wget -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 $MIN_VERSION > $serverPath/haproxy/version.pl
|
||||
echo 'Install_HA' > $install_tmp
|
||||
}
|
||||
|
||||
Uninstall_App()
|
||||
{
|
||||
if [ -f $serverPath/haproxy/initd/haproxy ];then
|
||||
$serverPath/haproxy/initd/haproxy stop
|
||||
fi
|
||||
|
||||
rm -rf $serverPath/haproxy
|
||||
echo "Uninstall_HA" > $install_tmp
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_App
|
||||
else
|
||||
Uninstall_App
|
||||
fi
|
||||
@@ -2180,8 +2180,11 @@ def installPreInspection(version):
|
||||
|
||||
|
||||
def uninstallPreInspection(version):
|
||||
# return "请手动删除MySQL[{}]".format(version)
|
||||
return 'ok'
|
||||
stop(version)
|
||||
if mw.isDebugMode():
|
||||
return 'ok'
|
||||
|
||||
return "请手动删除MariaDB[{}]<br/> rm -rf {}".format(version, getServerDir())
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
|
||||
@@ -14,7 +14,7 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=10.6.8
|
||||
MY_VER=10.6.9
|
||||
|
||||
Install_app()
|
||||
{
|
||||
@@ -57,10 +57,15 @@ Install_app()
|
||||
fi
|
||||
# ----- cpu end ------
|
||||
|
||||
# https://mirrors.aliyun.com/mariadb/mariadb-10.8.3/source/mariadb-10.8.3.tar.gz
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
# https://mirrors.aliyun.com/mariadb/mariadb-10.8.3/source/mariadb-10.8.3.tar.gz
|
||||
wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
# wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
|
||||
fi
|
||||
|
||||
# https://downloads.mariadb.org/interstitial/mariadb-10.6.8/source/mariadb-10.6.8.tar.gz
|
||||
if [ "$?" != "0" ];then
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
|
||||
@@ -14,7 +14,7 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=10.7.4
|
||||
MY_VER=10.7.5
|
||||
|
||||
Install_app()
|
||||
{
|
||||
@@ -58,14 +58,16 @@ Install_app()
|
||||
# ----- cpu end ------
|
||||
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
# wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ "$?" != "0" ];then
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
cd ${mariadbDir} && tar -zxvf ${mariadbDir}/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d $serverPath/mariadb ];then
|
||||
cd ${mariadbDir}/mariadb-${MY_VER} && cmake \
|
||||
|
||||
@@ -14,7 +14,7 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=10.8.3
|
||||
MY_VER=10.8.4
|
||||
|
||||
Install_app()
|
||||
{
|
||||
@@ -58,8 +58,11 @@ Install_app()
|
||||
# ----- cpu end ------
|
||||
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
# wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ "$?" != "0" ];then
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
|
||||
@@ -21,14 +21,26 @@ OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Install_app_mac()
|
||||
{
|
||||
if [ ! -f $serverPath/source/mongodb-macos-x86_64-${VERSION}.tgz ];then
|
||||
wget -O $serverPath/source/mongodb-macos-x86_64-${VERSION}.tgz https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-${VERSION}.tgz
|
||||
mkdir -p $serverPath/mongodb
|
||||
if [ "$VERSION" == "5.0" ];then
|
||||
G_VERSION="5.0.11"
|
||||
elif [[ "$VERSION" == "4.4" ]]; then
|
||||
G_VERSION="4.4.11"
|
||||
fi
|
||||
|
||||
cd $serverPath/source && tar -zxvf mongodb-macos-x86_64-${VERSION}.tgz
|
||||
cd mongodb-macos-x86_64-${VERSION} && mv ./* $serverPath/mongodb
|
||||
if [ ! -f $serverPath/source/mongodb-macos-x86_64-${G_VERSION}.tgz ];then
|
||||
wget -O $serverPath/source/mongodb-macos-x86_64-${G_VERSION}.tgz https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-${G_VERSION}.tgz
|
||||
fi
|
||||
|
||||
cd $serverPath/source && tar -zxvf mongodb-macos-x86_64-${G_VERSION}.tgz
|
||||
cd mongodb-macos-x86_64-${G_VERSION} && mv ./* $serverPath/mongodb
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
.conf_p span {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
width: 95px;
|
||||
width: 135px;
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -2338,8 +2338,11 @@ def installPreInspection(version):
|
||||
|
||||
|
||||
def uninstallPreInspection(version):
|
||||
# return "请手动删除MySQL[{}]".format(version)
|
||||
return 'ok'
|
||||
stop(version)
|
||||
if mw.isDebugMode():
|
||||
return 'ok'
|
||||
|
||||
return "请手动删除MySQL[{}]<br/> rm -rf {}".format(version, getServerDir())
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
|
||||
@@ -59,10 +59,12 @@ Install_openresty()
|
||||
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
|
||||
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
|
||||
--prefix=$serverPath/openresty \
|
||||
--with-ipv6 \
|
||||
--with-http_v2_module \
|
||||
--with-http_ssl_module \
|
||||
--with-http_slice_module \
|
||||
--with-http_stub_status_module
|
||||
--with-http_stub_status_module \
|
||||
--with-http_realip_module
|
||||
|
||||
make -j${cpuCore} && make install && make clean
|
||||
|
||||
|
||||
@@ -417,8 +417,8 @@ def setFpmConfig(version):
|
||||
max_spare_servers = args['max_spare_servers']
|
||||
pm = args['pm']
|
||||
|
||||
file = getServerDir() + '/php' + version + '/php-fpm.d/www.conf'
|
||||
conf = mw.readFile(file)
|
||||
filefpm = getFpmConfFile(version)
|
||||
conf = mw.readFile(filefpm)
|
||||
|
||||
rep = "\s*pm.max_children\s*=\s*([0-9]+)\s*"
|
||||
conf = re.sub(rep, "\npm.max_children = " + max_children, conf)
|
||||
@@ -437,7 +437,7 @@ def setFpmConfig(version):
|
||||
rep = "\s*pm\s*=\s*(\w+)\s*"
|
||||
conf = re.sub(rep, "\npm = " + pm + "\n", conf)
|
||||
|
||||
mw.writeFile(file, conf)
|
||||
mw.writeFile(filefpm, conf)
|
||||
reload(version)
|
||||
|
||||
msg = mw.getInfo('设置PHP-{1}并发设置,max_children={2},start_servers={3},min_spare_servers={4},max_spare_servers={5}',
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
{
|
||||
"name": "pdo",
|
||||
"versions": [
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
@@ -16,6 +21,11 @@
|
||||
"name": "mysqlnd",
|
||||
"versions": [
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
@@ -29,6 +39,11 @@
|
||||
"name": "sqlite3",
|
||||
"versions": [
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
@@ -50,6 +65,11 @@
|
||||
"name": "odbc",
|
||||
"versions": [
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
|
||||
@@ -412,15 +412,15 @@ def setFpmConfig(version):
|
||||
# if not 'max' in args:
|
||||
# return 'missing time args!'
|
||||
|
||||
version = args['version']
|
||||
max_children = args['max_children']
|
||||
start_servers = args['start_servers']
|
||||
min_spare_servers = args['min_spare_servers']
|
||||
max_spare_servers = args['max_spare_servers']
|
||||
pm = args['pm']
|
||||
|
||||
file = getServerDir() + '/php' + version + '/php-fpm.d/www.conf'
|
||||
conf = mw.readFile(file)
|
||||
# file = getServerDir() + '/php' + version + '/php-fpm.d/www.conf'
|
||||
filefpm = getFpmConfFile(version)
|
||||
conf = mw.readFile(filefpm)
|
||||
|
||||
rep = "\s*pm.max_children\s*=\s*([0-9]+)\s*"
|
||||
conf = re.sub(rep, "\npm.max_children = " + max_children, conf)
|
||||
@@ -439,7 +439,7 @@ def setFpmConfig(version):
|
||||
rep = "\s*pm\s*=\s*(\w+)\s*"
|
||||
conf = re.sub(rep, "\npm = " + pm + "\n", conf)
|
||||
|
||||
mw.writeFile(file, conf)
|
||||
mw.writeFile(filefpm, conf)
|
||||
reload(version)
|
||||
|
||||
msg = mw.getInfo('设置PHP-{1}并发设置,max_children={2},start_servers={3},min_spare_servers={4},max_spare_servers={5}', (version, max_children,
|
||||
|
||||
@@ -140,6 +140,26 @@
|
||||
"shell": "fileinfo.sh",
|
||||
"check": "fileinfo"
|
||||
},
|
||||
{
|
||||
"name": "simplexml",
|
||||
"versions": [
|
||||
"53",
|
||||
"54",
|
||||
"55",
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
],
|
||||
"type": "通用扩展",
|
||||
"msg": "用于XML!",
|
||||
"shell": "simplexml.sh",
|
||||
"check": "simplexml"
|
||||
},
|
||||
{
|
||||
"name": "exif",
|
||||
"versions": [
|
||||
|
||||
@@ -39,7 +39,11 @@ if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
mv $sourcePath/php/php-${version} $sourcePath/php/php${PHP_VER}
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
rm -rf $sourcePath/php/php-${version}.tar.xz
|
||||
echo "reinstall php${version}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $sourcePath/php/php${PHP_VER}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)"
|
||||
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
|
||||
|
||||
|
||||
version=8.0.21
|
||||
version=8.0.22
|
||||
PHP_VER=80
|
||||
Install_php()
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)"
|
||||
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
|
||||
|
||||
|
||||
version=8.1.8
|
||||
version=8.1.9
|
||||
PHP_VER=81
|
||||
Install_php()
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)"
|
||||
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
|
||||
|
||||
|
||||
version=8.2.0alpha2
|
||||
version=8.2.0beta3
|
||||
PHP_VER=82
|
||||
Install_php()
|
||||
{
|
||||
|
||||
Executable
+109
@@ -0,0 +1,109 @@
|
||||
#!/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")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sourcePath=${serverPath}/source/php
|
||||
|
||||
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
LIBNAME=igbinary
|
||||
LIBV=3.2.7
|
||||
|
||||
if [ "$version" -lt "70" ];then
|
||||
echo "not need"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LIB_PATH_NAME=lib/php
|
||||
if [ -d $serverPath/php/${version}/lib64 ];then
|
||||
LIB_PATH_NAME=lib64
|
||||
fi
|
||||
|
||||
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/${LIB_PATH_NAME}/extensions | grep no-debug-non-zts`
|
||||
extFile=$serverPath/php/${version}/${LIB_PATH_NAME}/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so
|
||||
|
||||
sysName=`uname`
|
||||
if [ "$sysName" == "Darwin" ];then
|
||||
BAK='_bak'
|
||||
else
|
||||
BAK=''
|
||||
fi
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_lib
|
||||
mkdir -p $php_lib
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
cd $php_lib
|
||||
tar xvf ${LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
cd $php_lib/${LIBNAME}-${LIBV}
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return;
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo $serverPath/php/$version/etc/php.ini
|
||||
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i $BAK "/${LIBNAME}.use_namespace/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i $BAK "/\[${LIBNAME}\]/d" $serverPath/php/$version/etc/php.ini
|
||||
|
||||
rm -f $extFile
|
||||
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -12,7 +12,7 @@ serverPath=$(dirname "$rootPath")
|
||||
sourcePath=${serverPath}/source/php
|
||||
|
||||
LIBNAME=memcached
|
||||
LIBV=3.2.0
|
||||
LIBV=3.1.5
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
@@ -12,7 +12,7 @@ serverPath=$(dirname "$rootPath")
|
||||
sourcePath=${serverPath}/source/php
|
||||
|
||||
LIBNAME=xhprof
|
||||
LIBV=2.3.5
|
||||
LIBV=2.3.7
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
@@ -202,6 +202,23 @@
|
||||
"shell": "exif.sh",
|
||||
"check": "exif.so"
|
||||
},
|
||||
{
|
||||
"name": "igbinary",
|
||||
"versions": [
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "通用扩展",
|
||||
"msg": "序列化扩展!",
|
||||
"shell": "igbinary.sh",
|
||||
"check": "igbinary.so"
|
||||
},
|
||||
{
|
||||
"name": "gd",
|
||||
"versions": [
|
||||
|
||||
@@ -135,11 +135,12 @@ def initDReceive():
|
||||
mw.writeFile(file_bin, content)
|
||||
mw.execShell('chmod +x ' + file_bin)
|
||||
|
||||
lock_file = getServerDir() + "/installed_rsyncd.pl"
|
||||
# systemd
|
||||
systemDir = mw.systemdCfgDir()
|
||||
systemService = systemDir + '/rsyncd.service'
|
||||
systemServiceTpl = getPluginDir() + '/init.d/rsyncd.service.tpl'
|
||||
if os.path.exists(systemDir) and not os.path.exists(systemService):
|
||||
if not os.path.exists(lock_file):
|
||||
rsync_bin = mw.execShell('which rsync')[0].strip()
|
||||
if rsync_bin == '':
|
||||
print('rsync missing!')
|
||||
@@ -152,6 +153,8 @@ def initDReceive():
|
||||
mw.writeFile(systemService, se)
|
||||
mw.execShell('systemctl daemon-reload')
|
||||
|
||||
mw.writeFile(lock_file, "ok")
|
||||
|
||||
rlog = getLog()
|
||||
if os.path.exists(rlog):
|
||||
mw.writeFile(rlog, '')
|
||||
@@ -199,7 +202,7 @@ def initDSend():
|
||||
mw.writeFile(systemService, content)
|
||||
mw.execShell('systemctl daemon-reload')
|
||||
|
||||
mw.writeFile(lock_file, "ok")
|
||||
mw.writeFile(lock_file, "ok")
|
||||
|
||||
lslog = getLsyncdLog()
|
||||
if os.path.exists(lslog):
|
||||
|
||||
@@ -23,7 +23,7 @@ Install_rsyncd()
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
|
||||
if [ "$OSNAME" == "debian'" ] || [ "$OSNAME" == "ubuntu'" ];then
|
||||
if [ "$OSNAME" == "debian" ] || [ "$OSNAME" == "ubuntu" ];then
|
||||
apt install -y rsync
|
||||
apt install -y lsyncd
|
||||
elif [[ "$OSNAME" == "arch" ]]; then
|
||||
|
||||
@@ -339,7 +339,10 @@ function createSendTask(name = ''){
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:2,time:2000,shade: [0.3, '#000']});
|
||||
|
||||
if (rdata.status){
|
||||
setTimeout(function(){layer.close(index);},2000);
|
||||
setTimeout(function(){
|
||||
layer.close(index);
|
||||
lsyncdSend();
|
||||
},2000);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -477,6 +477,28 @@ def readConfigLogTpl():
|
||||
return mw.returnJson(False, 'OK', '')
|
||||
|
||||
|
||||
def readConfigLogErrorTpl():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['file'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
file_log = args['file']
|
||||
line_log = args['line']
|
||||
|
||||
with open(file_log, "r") as fr:
|
||||
infos = fr.readlines()
|
||||
|
||||
stderr_logfile = ''
|
||||
for line in infos:
|
||||
if "stderr_logfile=" in line.strip():
|
||||
stderr_logfile = line.strip().split('=')[1]
|
||||
|
||||
if stderr_logfile != '':
|
||||
data = mw.getNumLines(stderr_logfile, int(line_log))
|
||||
return mw.returnJson(True, 'OK', data)
|
||||
return mw.returnJson(False, 'OK', '')
|
||||
|
||||
|
||||
def supClearLog():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['file'])
|
||||
@@ -529,6 +551,8 @@ if __name__ == "__main__":
|
||||
print(readConfigTpl())
|
||||
elif func == 'read_config_log_tpl':
|
||||
print(readConfigLogTpl())
|
||||
elif func == 'read_config_log_error_tpl':
|
||||
print(readConfigLogErrorTpl())
|
||||
elif func == 'sup_clear_log':
|
||||
print(supClearLog())
|
||||
elif func == 'conf':
|
||||
|
||||
@@ -405,7 +405,7 @@ function supConfigTpl(_name, version, func, config_tpl_func, read_config_tpl_fun
|
||||
return;
|
||||
}
|
||||
|
||||
$("#textBody").empty().text(rdata.data);
|
||||
$("#textBody").empty().html(rdata.data);
|
||||
$(".CodeMirror").remove();
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("textBody"), {
|
||||
extraKeys: {
|
||||
@@ -424,7 +424,7 @@ function supConfigTpl(_name, version, func, config_tpl_func, read_config_tpl_fun
|
||||
$(".CodeMirror-scroll").css({"height":"300px","margin":0,"padding":0});
|
||||
$("#onlineEditFileBtn").unbind('click');
|
||||
$("#onlineEditFileBtn").click(function(){
|
||||
$("#textBody").text(editor.getValue());
|
||||
$("#textBody").html(editor.getValue());
|
||||
pluginConfigSave(fileName);
|
||||
});
|
||||
},'json');
|
||||
@@ -474,6 +474,7 @@ function supLogs(_name, config_tpl_func, read_config_tpl_func,line){
|
||||
|
||||
var con = '<div><select id="config_tpl" class="bt-input-text mr20" style="width:30%;margin-bottom: 3px;"><option value="0">请选择</option></select>\
|
||||
<button id="sup_clear_log" class="btn btn-success btn-sm clear_logs mr5">清理日志</button>\
|
||||
<button id="sup_error_log" class="btn btn-success btn-sm clear_logs mr5">查看错误日志</button>\
|
||||
</div>';
|
||||
con += '<textarea readonly="" style="margin: 0px;width: 100%;height: 520px;background-color: #333;color:#fff; padding:0 5px" id="info_log"></textarea>';
|
||||
$(".soft-man-con").html(con);
|
||||
@@ -489,6 +490,21 @@ function supLogs(_name, config_tpl_func, read_config_tpl_func,line){
|
||||
});
|
||||
}
|
||||
|
||||
function errorLog(file,file_line){
|
||||
$('#sup_error_log').click(function(){
|
||||
var _args = JSON.stringify({file:file,line:file_line});
|
||||
$.post('/plugins/run', {name:_name, func:'read_config_log_error_tpl',args:_args}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
if (!rdata.status){
|
||||
layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
$("#info_log").empty().html(rdata.data);
|
||||
},'json');
|
||||
});
|
||||
}
|
||||
|
||||
var loadT = layer.msg('日志路径获取中...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
$.post('/plugins/run', {name:_name, func:_config_tpl_func},function (data) {
|
||||
layer.close(loadT);
|
||||
@@ -517,10 +533,11 @@ function supLogs(_name, config_tpl_func, read_config_tpl_func,line){
|
||||
return;
|
||||
}
|
||||
|
||||
$("#info_log").empty().text(rdata.data);
|
||||
$("#info_log").empty().html(rdata.data);
|
||||
},'json');
|
||||
|
||||
clearLog(selected);
|
||||
errorLog(selected,file_line);
|
||||
///
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
location / {
|
||||
|
||||
# https://www.cloudflare.com/zh-cn/ips/
|
||||
set_real_ip_from 103.21.244.0/22;
|
||||
set_real_ip_from 103.22.200.0/22;
|
||||
set_real_ip_from 103.31.4.0/22;
|
||||
set_real_ip_from 104.16.0.0/13;
|
||||
set_real_ip_from 104.24.0.0/14;
|
||||
set_real_ip_from 108.162.192.0/18;
|
||||
set_real_ip_from 131.0.72.0/22;
|
||||
set_real_ip_from 141.101.64.0/18;
|
||||
set_real_ip_from 162.158.0.0/15;
|
||||
set_real_ip_from 172.64.0.0/13;
|
||||
set_real_ip_from 173.245.48.0/20;
|
||||
set_real_ip_from 188.114.96.0/20;
|
||||
set_real_ip_from 190.93.240.0/20;
|
||||
set_real_ip_from 197.234.240.0/22;
|
||||
set_real_ip_from 198.41.128.0/17;
|
||||
set_real_ip_from 2400:cb00::/32;
|
||||
set_real_ip_from 2606:4700::/32;
|
||||
set_real_ip_from 2803:f800::/32;
|
||||
set_real_ip_from 2405:b500::/32;
|
||||
set_real_ip_from 2405:8100::/32;
|
||||
set_real_ip_from 2c0f:f248::/32;
|
||||
set_real_ip_from 2a06:98c0::/29;
|
||||
# use any of the following two
|
||||
real_ip_header CF-Connecting-IP;
|
||||
#real_ip_header X-Forwarded-For;
|
||||
|
||||
|
||||
index index.html index.php;
|
||||
if (-f $request_filename/index.html){
|
||||
rewrite (.*) $1/index.html break;
|
||||
}
|
||||
if (-f $request_filename/index.php){
|
||||
rewrite (.*) $1/index.php;
|
||||
}
|
||||
if (!-f $request_filename){
|
||||
rewrite (.*) /index.php;
|
||||
}
|
||||
}
|
||||
|
||||
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
|
||||
+30
-31
@@ -1,34 +1,33 @@
|
||||
location / {
|
||||
if (!-e $request_filename)
|
||||
{
|
||||
rewrite "^/index\.html" /index.php last;
|
||||
rewrite "^/category$" /index.php last;
|
||||
rewrite "^/feed-c([0-9]+)\.xml$" /feed.php?cat=$1 last;
|
||||
rewrite "^/feed-b([0-9]+)\.xml$" /feed.php?brand=$1 last;
|
||||
rewrite "^/feed\.xml$" /feed.php last;
|
||||
rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 last;
|
||||
rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 last;
|
||||
rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last;
|
||||
rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3 last;
|
||||
rewrite "^/category-([0-9]+)-b([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2 last;
|
||||
rewrite "^/category-([0-9]+)(.*)\.html$" /category.php?id=$1 last;
|
||||
rewrite "^/goods-([0-9]+)(.*)\.html" /goods.php?id=$1 last;
|
||||
rewrite "^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /article_cat.php?id=$1&page=$2&sort=$3&order=$4 last;
|
||||
rewrite "^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$" /article_cat.php?id=$1&page=$2 last;
|
||||
rewrite "^/article_cat-([0-9]+)(.*)\.html$" /article_cat.php?id=$1 last;
|
||||
rewrite "^/article-([0-9]+)(.*)\.html$" /article.php?id=$1 last;
|
||||
rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html" /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 last;
|
||||
rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2&page=$3 last;
|
||||
rewrite "^/brand-([0-9]+)-c([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2 last;
|
||||
rewrite "^/brand-([0-9]+)(.*)\.html" /brand.php?id=$1 last;
|
||||
rewrite "^/tag-(.*)\.html" /search.php?keywords=$1 last;
|
||||
rewrite "^/snatch-([0-9]+)\.html$" /snatch.php?id=$1 last;
|
||||
rewrite "^/group_buy-([0-9]+)\.html$" /group_buy.php?act=view&id=$1 last;
|
||||
rewrite "^/auction-([0-9]+)\.html$" /auction.php?act=view&id=$1 last;
|
||||
rewrite "^/exchange-id([0-9]+)(.*)\.html$" /exchange.php?id=$1&act=view last;
|
||||
rewrite "^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 last;
|
||||
rewrite ^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last;
|
||||
rewrite "^/exchange-([0-9]+)-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2 last;
|
||||
rewrite "^/exchange-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1 last;
|
||||
if (!-e $request_filename) {
|
||||
rewrite "^/index\.html" /index.php last;
|
||||
rewrite "^/category$" /index.php last;
|
||||
rewrite "^/feed-c([0-9]+)\.xml$" /feed.php?cat=$1 last;
|
||||
rewrite "^/feed-b([0-9]+)\.xml$" /feed.php?brand=$1 last;
|
||||
rewrite "^/feed\.xml$" /feed.php last;
|
||||
rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 last;
|
||||
rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 last;
|
||||
rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last;
|
||||
rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3 last;
|
||||
rewrite "^/category-([0-9]+)-b([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2 last;
|
||||
rewrite "^/category-([0-9]+)(.*)\.html$" /category.php?id=$1 last;
|
||||
rewrite "^/goods-([0-9]+)(.*)\.html" /goods.php?id=$1 last;
|
||||
rewrite "^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /article_cat.php?id=$1&page=$2&sort=$3&order=$4 last;
|
||||
rewrite "^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$" /article_cat.php?id=$1&page=$2 last;
|
||||
rewrite "^/article_cat-([0-9]+)(.*)\.html$" /article_cat.php?id=$1 last;
|
||||
rewrite "^/article-([0-9]+)(.*)\.html$" /article.php?id=$1 last;
|
||||
rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html" /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 last;
|
||||
rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2&page=$3 last;
|
||||
rewrite "^/brand-([0-9]+)-c([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2 last;
|
||||
rewrite "^/brand-([0-9]+)(.*)\.html" /brand.php?id=$1 last;
|
||||
rewrite "^/tag-(.*)\.html" /search.php?keywords=$1 last;
|
||||
rewrite "^/snatch-([0-9]+)\.html$" /snatch.php?id=$1 last;
|
||||
rewrite "^/group_buy-([0-9]+)\.html$" /group_buy.php?act=view&id=$1 last;
|
||||
rewrite "^/auction-([0-9]+)\.html$" /auction.php?act=view&id=$1 last;
|
||||
rewrite "^/exchange-id([0-9]+)(.*)\.html$" /exchange.php?id=$1&act=view last;
|
||||
rewrite "^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 last;
|
||||
rewrite ^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last;
|
||||
rewrite "^/exchange-([0-9]+)-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2 last;
|
||||
rewrite "^/exchange-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1 last;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
location /{
|
||||
location / {
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^(.*)$ /index.php/$1 last;
|
||||
break;
|
||||
|
||||
@@ -3,3 +3,11 @@ location / {
|
||||
rewrite ^(.*)$ /index.php$1 last;
|
||||
}
|
||||
}
|
||||
|
||||
# 不需要,可以删除
|
||||
location /typecho/ {
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^(.*)$ /typecho/index.php$1 last;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
location /typecho/ {
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^(.*)$ /typecho/index.php$1 last;
|
||||
}
|
||||
}
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
location / {
|
||||
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^/contact/$ /./contact.php last;
|
||||
rewrite ^/status$ /./pages.php?cate=$1&page=status last;
|
||||
rewrite ^/act$ /./pages.php?cate=$1&page=actindex last;
|
||||
rewrite ^/(\w+)/(\w+)/$ /./pages.php?cate=$1&page=$2 last;
|
||||
rewrite ^/cart/(\w+)$ /./cart.php?a=$1 last;
|
||||
rewrite ^/console$ /./clientarea.php last;
|
||||
rewrite ^/sitemap.xml$ /./sitemap.php last;
|
||||
rewrite ^/console/(\w+)$ /./clientarea.php?action=services&group=$1 last;
|
||||
rewrite ^/console/ec/([0-9]+)$ /./clientarea.php?action=productdetails&id=$1 last;
|
||||
rewrite ^/console/ec/(\w+)$ /./clientarea.php?action=services&group=ec&page=$1 last;
|
||||
rewrite ^ /index.php last;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
location / {
|
||||
rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last;
|
||||
if (!-e $request_filename){
|
||||
rewrite ^.+?(/wp-.*) $1 last;
|
||||
rewrite ^.+?(/.*\.php)$ $1 last;
|
||||
rewrite ^ /index.php last;
|
||||
}
|
||||
}
|
||||
+38
-17
@@ -77,7 +77,7 @@ $(".networkbtn").click(function(){
|
||||
function Wday(day,name){
|
||||
var now = (new Date().getTime())/1000;
|
||||
if(day==0){
|
||||
var b = (new Date(GetToday() + " 00:00:01").getTime())/1000;
|
||||
var b = (new Date(getToday() + " 00:00:01").getTime())/1000;
|
||||
b = Math.round(b);
|
||||
var e = Math.round(now);
|
||||
}
|
||||
@@ -111,7 +111,7 @@ function Wday(day,name){
|
||||
}
|
||||
}
|
||||
|
||||
function GetToday(){
|
||||
function getToday(){
|
||||
var mydate = new Date();
|
||||
var str = "" + mydate.getFullYear() + "/";
|
||||
str += (mydate.getMonth()+1) + "/";
|
||||
@@ -123,30 +123,51 @@ function GetToday(){
|
||||
function getStatus(){
|
||||
loadT = layer.msg('正在读取,请稍候...',{icon:16,time:0})
|
||||
$.post('/system/set_control','type=-1',function(rdata){
|
||||
// console.log(rdata);
|
||||
layer.close(loadT);
|
||||
|
||||
if(rdata.status){
|
||||
$("#openJK").html("<input class='btswitch btswitch-ios' id='ctswitch' type='checkbox' checked><label class='btswitch-btn' for='ctswitch' onclick='setControl()'></label>")
|
||||
$("#openJK").html("<input class='btswitch btswitch-ios' id='ctswitch' type='checkbox' checked><label class='btswitch-btn' for='ctswitch' onclick='setControl(\"openjk\", true)'></label>");
|
||||
} else {
|
||||
$("#openJK").html("<input class='btswitch btswitch-ios' id='ctswitch' type='checkbox'><label class='btswitch-btn' for='ctswitch' onclick='setControl(\"openjk\",false)'></label>");
|
||||
}
|
||||
else{
|
||||
$("#openJK").html("<input class='btswitch btswitch-ios' id='ctswitch' type='checkbox'><label class='btswitch-btn' for='ctswitch' onclick='setControl()'></label>")
|
||||
|
||||
if(rdata.stat_all_status){
|
||||
$("#statAll").html("<input class='btswitch btswitch-ios' id='stat_witch' type='checkbox' checked><label class='btswitch-btn' for='stat_witch' onclick='setControl(\"stat\",true)'></label>");
|
||||
} else{
|
||||
$("#statAll").html("<input class='btswitch btswitch-ios' id='stat_witch' type='checkbox'><label class='btswitch-btn' for='stat_witch' onclick='setControl(\"stat\",false)'></label>");
|
||||
}
|
||||
$("#saveDay").val(rdata.day)
|
||||
|
||||
$("#save_day").val(rdata.day);
|
||||
|
||||
},'json');
|
||||
}
|
||||
getStatus();
|
||||
|
||||
//设置监控状态
|
||||
function setControl(act){
|
||||
var day = $("#saveDay").val()
|
||||
if(day < 1){
|
||||
layer.msg('保存天数不合法!',{icon:2});
|
||||
return;
|
||||
}
|
||||
if(act){
|
||||
var type = $("#ctswitch").prop('checked')?'1':'0';
|
||||
}else{
|
||||
function setControl(act, value=false){
|
||||
|
||||
if (act == 'openjk'){
|
||||
var type = $("#ctswitch").prop('checked')?'0':'1';
|
||||
var day = $("#save_day").val();
|
||||
if(day < 1){
|
||||
layer.msg('保存天数不合法!',{icon:2});
|
||||
return;
|
||||
}
|
||||
} else if (act == 'stat'){
|
||||
var type = $("#stat_witch").prop('checked')?'2':'3';
|
||||
} else if (act == 'save_day'){
|
||||
var type = $("#ctswitch").prop('checked')?'1':'0';
|
||||
var day = $("#save_day").val();
|
||||
|
||||
if(type == 0){
|
||||
layer.msg('先开启监控!',{icon:2});
|
||||
return;
|
||||
}
|
||||
|
||||
if(day < 1){
|
||||
layer.msg('保存天数不合法!',{icon:2});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
loadT = layer.msg('正在处理,请稍候...',{icon:16,time:0})
|
||||
@@ -156,13 +177,13 @@ function setControl(act){
|
||||
},'json');
|
||||
}
|
||||
|
||||
|
||||
//清理记录
|
||||
function closeControl(){
|
||||
layer.confirm('您真的清空所有监控记录吗?',{title:'清空记录',icon:3,closeBtn:2}, function() {
|
||||
loadT = layer.msg('正在处理,请稍候...',{icon:16,time:0})
|
||||
$.post('/system/set_control','type=del',function(rdata){
|
||||
layer.close(loadT);
|
||||
// $.get('/system?action=ReWeb',function(){});
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:2});
|
||||
},'json');
|
||||
});
|
||||
|
||||
+16
-11
@@ -203,6 +203,7 @@ function planAdd(){
|
||||
$("#set-Config input[name='type']").val(type);
|
||||
|
||||
var where1 = $("#ptime input[name='where1']").val();
|
||||
|
||||
var is1;
|
||||
var is2 = 1;
|
||||
switch(type){
|
||||
@@ -226,6 +227,7 @@ function planAdd(){
|
||||
return;
|
||||
}
|
||||
|
||||
where1 = $('#excode_week b').attr('val');
|
||||
$("#set-Config input[name='where1']").val(where1);
|
||||
|
||||
var hour = $("#ptime input[name='hour']").val();
|
||||
@@ -305,7 +307,9 @@ function planAdd(){
|
||||
|
||||
$("#set-Config input[name='sName']").val(sName);
|
||||
layer.msg('正在添加,请稍候...!',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
var data= $("#set-Config").serialize() + '&sBody='+sBody + '&urladdress=' + urladdress;
|
||||
var data = $("#set-Config").serialize() + '&sBody='+sBody + '&urladdress=' + urladdress;
|
||||
|
||||
console.log(data);
|
||||
$.post('/crontab/add',data,function(rdata){
|
||||
if(!rdata.status) {
|
||||
layer.msg(rdata.msg,{icon:2, time:2000});
|
||||
@@ -469,9 +473,9 @@ function toBackup(type){
|
||||
sOpt += '<li><a role="menuitem" tabindex="-1" href="javascript:;" value="'+rdata.data[i].name+'">'+rdata.data[i].name+'['+rdata.data[i].ps+']</a></li>';
|
||||
}
|
||||
|
||||
var orderOpt = ''
|
||||
var orderOpt = '';
|
||||
for (var i=0;i<rdata.orderOpt.length;i++){
|
||||
orderOpt += '<li><a role="menuitem" tabindex="-1" href="javascript:;" value="'+rdata.orderOpt[i].value+'">'+rdata.orderOpt[i].name+'</a></li>'
|
||||
orderOpt += '<li><a role="menuitem" tabindex="-1" href="javascript:;" value="'+rdata.orderOpt[i].name+'">'+rdata.orderOpt[i].title+'</a></li>'
|
||||
}
|
||||
|
||||
|
||||
@@ -514,7 +518,7 @@ function editTaskInfo(id){
|
||||
layer.msg('正在获取,请稍候...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
$.post('/crontab/get_crond_find',{id:id},function(rdata){
|
||||
layer.closeAll();
|
||||
// console.log('init:', rdata);
|
||||
// console.log('get_crond_find:', rdata);
|
||||
var sTypeName = '',sTypeDom = '',cycleName = '',cycleDom = '',weekName = '',weekDom = '',sNameName ='',sNameDom = '',backupsName = '',backupsDom ='';
|
||||
obj = {
|
||||
from:{
|
||||
@@ -557,10 +561,11 @@ function editTaskInfo(id){
|
||||
|
||||
if(obj.from.stype == 'site' || obj.from.stype == 'database' || obj.from.stype == 'path' || obj.from.stype == 'logs'){
|
||||
$.post('/crontab/get_data_list',{type:obj.from.stype == 'databases'?'database':'sites'},function(rdata){
|
||||
// console.log(rdata);
|
||||
obj.sNameArray = rdata.data;
|
||||
obj.sNameArray.unshift({name:'ALL',ps:'所有'});
|
||||
obj.backupsArray = rdata.orderOpt;
|
||||
obj.backupsArray.unshift({name:'服务器磁盘',value:'localhost'});
|
||||
obj.backupsArray.unshift({title:'服务器磁盘',name:'localhost'});
|
||||
for(var i = 0; i <obj['sNameArray'].length; i++){
|
||||
if(obj.from['sname'] == obj['sNameArray'][i]['name']){
|
||||
sNameName = obj['sNameArray'][i]['ps'];
|
||||
@@ -568,10 +573,10 @@ function editTaskInfo(id){
|
||||
sNameDom += '<li><a role="menuitem" href="javascript:;" value="'+ obj['sNameArray'][i]['name'] +'">'+ obj['sNameArray'][i]['ps'] +'</a></li>';
|
||||
}
|
||||
for(var i = 0; i <obj['backupsArray'].length; i++){
|
||||
if(obj.from['backup_to'] == obj['backupsArray'][i]['value']) {
|
||||
backupsName = obj['backupsArray'][i]['name'];
|
||||
if(obj.from['backup_to'] == obj['backupsArray'][i]['name']) {
|
||||
backupsName = obj['backupsArray'][i]['title'];
|
||||
}
|
||||
backupsDom += '<li><a role="menuitem" href="javascript:;" value="'+ obj['backupsArray'][i]['value'] +'">'+ obj['backupsArray'][i]['name'] +'</a></li>';
|
||||
backupsDom += '<li><a role="menuitem" href="javascript:;" value="'+ obj['backupsArray'][i]['name'] +'">'+ obj['backupsArray'][i]['title'] +'</a></li>';
|
||||
}
|
||||
callback();
|
||||
},'json');
|
||||
@@ -629,7 +634,7 @@ function editTaskInfo(id){
|
||||
<span class="typename controls c4 pull-left f14 text-right mr20">'+ sTypeName +'</span>\
|
||||
<div style="line-height:34px"><div class="dropdown pull-left mr20 sName_btn" style="display:'+ (obj.from.sType != "path"?'block;':'none') +'">\
|
||||
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="width:auto" disabled="disabled">\
|
||||
<b id="sName" val="'+ obj.from.sname +'">'+ sNameName +'</b>\
|
||||
<b id="sName" val="'+ obj.from.sname +'">'+ obj.from.sname +'</b>\
|
||||
<span class="caret"></span>\
|
||||
</button>\
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="sName">'+ sNameDom +'</ul>\
|
||||
@@ -835,10 +840,10 @@ function closeOpt(){
|
||||
//星期
|
||||
function toWeek(){
|
||||
var mBody = '<div class="dropdown planweek pull-left mr20">\
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="excode" data-toggle="dropdown">\
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="excode_week" data-toggle="dropdown">\
|
||||
<b val="1">周一</b> <span class="caret"></span>\
|
||||
</button>\
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="excode">\
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="excode_week">\
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="1">周一</a></li>\
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="2">周二</a></li>\
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="3">周三</a></li>\
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
@@ -13,20 +13,26 @@
|
||||
<div class="mr50 pull-left">
|
||||
<div class="ss-text pull-left">
|
||||
<em>开启监控</em>
|
||||
<div class='ssh-item' id="openJK">
|
||||
</div>
|
||||
<div class='ssh-item' id="openJK"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mr50 pull-left">
|
||||
<div class="ss-text pull-left">
|
||||
<em>保存天数:</em>
|
||||
<input class="bt-input-text" id="saveDay" value="" type="number">
|
||||
<input class="bt-input-text" id="save_day" value="" type="number">
|
||||
</div>
|
||||
<div class="ss-text pull-left" style="margin-left:10px">
|
||||
<button class="btn btn-default btn-sm" type="button" onclick="setControl(true);">更改</button>
|
||||
<button class="btn btn-default btn-sm" type="button" onclick="setControl('save_day',true);">更改</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mr50 pull-left" style="padding-left:50px; border-left:#ccc 1px solid; margin-right:0">
|
||||
<div class="mr50 pull-left" style="padding-left:10px; border-left:#ccc 1px solid; margin-right:0">
|
||||
<div class="mr50 pull-left">
|
||||
<div class="ss-text pull-left">
|
||||
<em>仅统计外网</em>
|
||||
<div class='ssh-item' id="statAll"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-default btn-sm" type="button" onclick="closeControl()">清空记录</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -38,6 +38,9 @@ elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
|
||||
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
|
||||
OSNAME='alma'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then
|
||||
OSNAME='amazon'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
apt update -y
|
||||
|
||||
Executable
+166
@@ -0,0 +1,166 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
LANG=en_US.UTF-8
|
||||
|
||||
if [ ! -f /usr/bin/applydeltarpm ];then
|
||||
yum -y provides '*/applydeltarpm'
|
||||
yum -y install deltarpm
|
||||
fi
|
||||
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
setenforce 0
|
||||
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
|
||||
|
||||
yum install -y wget lsof crontabs
|
||||
yum install -y python3-devel
|
||||
yum install -y python3-pip
|
||||
yum install -y python-devel
|
||||
yum install -y curl-devel libmcrypt libmcrypt-devel
|
||||
yum install -y mysql-devel
|
||||
yum install -y expect
|
||||
|
||||
|
||||
|
||||
#https need
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/iptables ];then
|
||||
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
|
||||
service iptables save
|
||||
|
||||
iptables_status=`service iptables status | grep 'not running'`
|
||||
if [ "${iptables_status}" == '' ];then
|
||||
service iptables restart
|
||||
fi
|
||||
|
||||
#安装时不开启
|
||||
service iptables stop
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f /etc/init.d/iptables ];then
|
||||
yum install firewalld -y
|
||||
systemctl enable firewalld
|
||||
#取消服务锁定
|
||||
systemctl unmask firewalld
|
||||
systemctl start firewalld
|
||||
|
||||
firewall-cmd --permanent --zone=public --add-port=22/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=80/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
|
||||
sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf
|
||||
firewall-cmd --reload
|
||||
#安装时不开启
|
||||
systemctl stop firewalld
|
||||
fi
|
||||
|
||||
yum groupinstall -y "Development Tools"
|
||||
yum install -y epel-release
|
||||
|
||||
yum install -y oniguruma oniguruma-devel
|
||||
#centos8 stream | use dnf
|
||||
if [ "$?" != "0" ];then
|
||||
yum install -y dnf dnf-plugins-core
|
||||
dnf config-manager --set-enabled powertools
|
||||
yum install -y oniguruma oniguruma-devel
|
||||
dnf upgrade -y libmodulemd
|
||||
fi
|
||||
|
||||
|
||||
yum install -y libtirpc libtirpc-devel
|
||||
yum install -y rpcgen
|
||||
yum install -y openldap openldap-devel
|
||||
yum install -y bison re2c
|
||||
yum install -y cmake3
|
||||
yum install -y autoconf
|
||||
yum install -y make cmake gcc gcc-c++
|
||||
|
||||
yum install -y libmemcached libmemcached-devel
|
||||
yum install -y curl curl-devel
|
||||
yum install -y zlib zlib-devel
|
||||
yum install -y libzip libzip-devel
|
||||
yum install -y pcre pcre-devel
|
||||
yum install -y icu libicu-devel
|
||||
yum install -y freetype freetype-devel
|
||||
yum install -y openssl openssl-devel
|
||||
yum install -y graphviz libxml2 libxml2-devel
|
||||
yum install -y sqlite-devel
|
||||
yum install -y oniguruma oniguruma-devel
|
||||
yum install -y ImageMagick ImageMagick-devel
|
||||
|
||||
|
||||
yum install -y libzstd-devel
|
||||
yum install -y libevent libevent-devel unzip zip
|
||||
yum install -y python-imaging libicu-devel bzip2-devel pcre pcre-devel
|
||||
|
||||
yum install -y gd gd-devel
|
||||
yum install -y libjpeg-devel libpng-devel libwebp libwebp-devel
|
||||
|
||||
yum install -y net-tools
|
||||
yum install -y ncurses-devel
|
||||
|
||||
|
||||
for yumPack in flex file libtool libtool-libs kernel-devel patch wget glib2 glib2-devel tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel libidn libidn-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel libcap diffutils ca-certificates net-tools psmisc libXpm-devel git-core c-ares-devel libicu-devel libxslt libxslt-devel zip unzip glibc.i686 libstdc++.so.6 cairo-devel ncurses-devel libaio-devel perl perl-devel perl-Data-Dumper expat-devel readline-devel;
|
||||
do yum -y install $yumPack;done
|
||||
|
||||
|
||||
if [ "$VERSION_ID" -eq "8" ];then
|
||||
dnf upgrade -y libmodulemd
|
||||
fi
|
||||
|
||||
if [ "$VERSION_ID" -eq "9" ];then
|
||||
yum install -y patchelf
|
||||
dnf --enablerepo=crb install -y libtirpc-devel
|
||||
dnf --enablerepo=crb install -y libmemcached libmemcached-devel
|
||||
dnf --enablerepo=crb install -y libtool libtool-libs
|
||||
dnf --enablerepo=crb install -y gnutls-devel
|
||||
dnf --enablerepo=crb install -y mysql-devel
|
||||
|
||||
dnf --enablerepo=crb install -y libvpx-devel libXpm-devel libwebp libwebp-devel
|
||||
dnf --enablerepo=crb install -y oniguruma oniguruma-devel
|
||||
dnf --enablerepo=crb install -y libzip libzip-devel
|
||||
# yum remove -y chardet
|
||||
fi
|
||||
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
cd /www/server/mdserver-web && ./cli.sh start
|
||||
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
||||
n=0
|
||||
while [[ ! -f /etc/init.d/mw ]];
|
||||
do
|
||||
echo -e ".\c"
|
||||
sleep 1
|
||||
let n+=1
|
||||
if [ $n -gt 20 ];then
|
||||
echo -e "start mw fail"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
cd /www/server/mdserver-web && /etc/init.d/mw stop
|
||||
cd /www/server/mdserver-web && /etc/init.d/mw start
|
||||
cd /www/server/mdserver-web && /etc/init.d/mw default
|
||||
|
||||
|
||||
|
||||
@@ -109,14 +109,13 @@ yum install -y ImageMagick ImageMagick-devel
|
||||
|
||||
yum install -y libzstd-devel
|
||||
yum install -y libevent libevent-devel unzip zip
|
||||
yum install -y python-imaging libicu-devel bzip2-devel gcc pcre pcre-devel
|
||||
yum install -y python-imaging libicu-devel bzip2-devel pcre pcre-devel
|
||||
|
||||
yum install -y gd gd-devel
|
||||
yum install -y libjpeg-devel libpng-devel libwebp libwebp-devel
|
||||
|
||||
yum install -y net-tools
|
||||
yum install -y ncurses-devel
|
||||
yum install -y vixie-cron
|
||||
|
||||
|
||||
for yumPack in flex file libtool libtool-libs kernel-devel patch wget glib2 glib2-devel tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel libidn libidn-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel libcap diffutils ca-certificates net-tools psmisc libXpm-devel git-core c-ares-devel libicu-devel libxslt libxslt-devel zip unzip glibc.i686 libstdc++.so.6 cairo-devel ncurses-devel libaio-devel perl perl-devel perl-Data-Dumper expat-devel readline-devel;
|
||||
|
||||
@@ -19,7 +19,6 @@ if [ "$EUID" -ne 0 ]
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ ${_os} == "Darwin" ]; then
|
||||
OSNAME='macos'
|
||||
elif grep -Eq "openSUSE" /etc/*-release; then
|
||||
@@ -27,10 +26,6 @@ elif grep -Eq "openSUSE" /etc/*-release; then
|
||||
zypper refresh
|
||||
elif grep -Eq "FreeBSD" /etc/*-release; then
|
||||
OSNAME='freebsd'
|
||||
pkg install -y wget unzip
|
||||
elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then
|
||||
OSNAME='arch'
|
||||
echo y | pacman -Sy unzip
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
|
||||
OSNAME='centos'
|
||||
yum install -y wget zip unzip
|
||||
@@ -43,6 +38,9 @@ elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
|
||||
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
|
||||
OSNAME='alma'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then
|
||||
OSNAME='amazon'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
apt update -y
|
||||
|
||||
@@ -34,6 +34,9 @@ elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
|
||||
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
|
||||
OSNAME='alma'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then
|
||||
OSNAME='amazon'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
apt install -y wget zip unzip
|
||||
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
LANG=en_US.UTF-8
|
||||
|
||||
|
||||
if [ -f /etc/motd ];then
|
||||
echo "welcome to mdserver-web panel" > /etc/motd
|
||||
fi
|
||||
|
||||
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
|
||||
|
||||
yum install -y curl-devel libmcrypt libmcrypt-devel python3-devel
|
||||
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
if [ -f /etc/init.d/mw ]; then
|
||||
sh /etc/init.d/mw stop && rm -rf /www/server/mdserver-web/scripts/init.d/mw && rm -rf /etc/init.d/mw
|
||||
fi
|
||||
|
||||
echo -e "stop mw"
|
||||
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
||||
|
||||
port=7200
|
||||
if [ -f /www/server/mdserver-web/data/port.pl ]; then
|
||||
port=$(cat /www/server/mdserver-web/data/port.pl)
|
||||
fi
|
||||
|
||||
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)
|
||||
let n+=1
|
||||
if [ $n -gt 15 ];then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
echo -e "start mw"
|
||||
cd /www/server/mdserver-web && sh cli.sh start
|
||||
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
||||
n=0
|
||||
while [[ ! -f /etc/init.d/mw ]];
|
||||
do
|
||||
echo -e ".\c"
|
||||
sleep 0.5
|
||||
let n+=1
|
||||
if [ $n -gt 15 ];then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
echo -e "start mw success"
|
||||
|
||||
bash /etc/init.d/mw default
|
||||
+11
-3
@@ -22,8 +22,6 @@ elif grep -Eq "openSUSE" /etc/*-release; then
|
||||
zypper refresh
|
||||
elif grep -Eq "FreeBSD" /etc/*-release; then
|
||||
OSNAME='freebsd'
|
||||
elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then
|
||||
OSNAME='arch'
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
|
||||
OSNAME='centos'
|
||||
yum install -y wget zip unzip
|
||||
@@ -36,6 +34,9 @@ elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
|
||||
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
|
||||
OSNAME='alma'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then
|
||||
OSNAME='amazon'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
apt install -y wget zip unzip
|
||||
@@ -48,7 +49,14 @@ else
|
||||
OSNAME='unknow'
|
||||
fi
|
||||
|
||||
wget -O /tmp/dev.zip https://github.com/midoks/mdserver-web/archive/refs/heads/dev.zip
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ];then
|
||||
wget -O /tmp/dev.zip https://gitee.com/midoks/mdserver-web/repository/archive/dev.zip
|
||||
else
|
||||
wget -O /tmp/dev.zip https://github.com/midoks/mdserver-web/archive/refs/heads/dev.zip
|
||||
fi
|
||||
|
||||
# wget -O /tmp/dev.zip https://github.com/midoks/mdserver-web/archive/refs/heads/dev.zip
|
||||
cd /tmp && unzip /tmp/dev.zip
|
||||
cp -rf /tmp/mdserver-web-dev/* /www/server/mdserver-web
|
||||
rm -rf /tmp/dev.zip
|
||||
|
||||
Reference in New Issue
Block a user