Compare commits

...
148 Commits
Author SHA1 Message Date
Mr Chen 4b71d6b3d7 Merge pull request #185 from midoks/dev
0.9.9
2022-09-09 21:31:36 +08:00
midoks becb7f8c7f Update README.md 2022-09-09 21:21:33 +08:00
midoks 3da7b57242 Update README.md 2022-09-08 23:39:33 +08:00
midoks 42e8057356 Update memcached.sh 2022-09-08 21:49:03 +08:00
midoks e082baabe8 PHP加入igbinary扩展 2022-09-08 21:16:59 +08:00
midoks 74d565c99a 0.9.9 2022-09-08 15:40:47 +08:00
midoks 750efbf430 Update xhprof.sh 2022-09-07 14:39:43 +08:00
midoks 68112ba978 Update install.sh 2022-09-07 10:16:03 +08:00
midoks e994375fc8 Update cloudfare_real_ip.conf 2022-09-07 09:54:20 +08:00
midoks 998f677ee7 Create cloudfare_real_ip.conf 2022-09-07 09:06:15 +08:00
midoks 8b1b50938d Update README.md 2022-09-06 22:41:11 +08:00
midoks 3dbece0b5e Update README.md 2022-09-06 22:19:57 +08:00
midoks e9f1e522de Update README.md 2022-09-06 22:19:21 +08:00
midoks 8a815159c1 Update README.md 2022-09-06 22:08:42 +08:00
midoks c8af676d6f up 2022-09-06 22:07:12 +08:00
midoks 3bee84a52f Update README.md 2022-09-06 21:54:07 +08:00
midoks 82828aacf6 优化gogs插件 2022-09-06 17:45:56 +08:00
midoks e4de3cff61 更新图标 2022-09-06 15:35:03 +08:00
midoks 4ed7f5d7fd Update index.py 2022-09-05 23:06:31 +08:00
midoks 7b956c73e4 Update index.py 2022-09-05 22:58:53 +08:00
midoks 8535dd2306 up 2022-09-05 22:56:38 +08:00
midoks e13df3ae58 Update index.py 2022-09-05 22:49:57 +08:00
midoks 44fa68f52d Update index.py 2022-09-05 22:48:25 +08:00
midoks d72abb1e30 修复php-yum无法更改性能调整 2022-09-05 22:33:30 +08:00
midoks aad4343a59 Update whmcs.conf 2022-09-05 11:36:00 +08:00
midoks 6b5717b04f 优化的配置模板 2022-09-04 18:16:04 +08:00
midoks 655946a467 Update install.sh 2022-09-04 17:18:45 +08:00
midoks 80f3d98162 Update update_dev.sh 2022-09-04 17:07:51 +08:00
midoks d73be680e2 Update README.md 2022-09-04 17:04:48 +08:00
midoks ad9595b3b2 Update update_dev.sh 2022-09-04 17:01:47 +08:00
midoks 8a337fcfd6 Update site_api.py 2022-09-03 23:37:17 +08:00
midoks 38b1dba395 卸载是停止 2022-09-03 23:08:41 +08:00
midoks 7195de0418 up 2022-09-03 21:31:22 +08:00
midoks 20cb30ba51 Update update_dev.sh 2022-09-03 21:24:26 +08:00
midoks 2a7c96b0f5 Update install_dev.sh 2022-09-03 21:24:08 +08:00
midoks 8503e6ebe9 增加 amazon 2022-09-03 21:21:12 +08:00
midoks be2c2a2436 Update phplib.conf 2022-09-03 19:00:18 +08:00
midoks 8a247c93d4 Update memcached.sh 2022-09-03 17:54:55 +08:00
midoks b4cdc7fc2d Update memcached.sh 2022-09-03 17:43:23 +08:00
midoks cc3f1ed01a Update README.md 2022-09-03 15:53:22 +08:00
midoks 4db4284362 Update README.md 2022-09-03 15:51:03 +08:00
midoks 3c2e517c61 Update README.md 2022-09-03 14:17:01 +08:00
midoks 1d712d1f84 Update README.md 2022-09-03 14:08:17 +08:00
midoks f1e1e3c82c Update README.md 2022-09-03 13:43:18 +08:00
midoks 8e587cf055 Update install.sh 2022-09-02 23:16:41 +08:00
Mr Chen 277b95f74b Merge pull request #183 from itcbx/dev
修复rsyncd在debian或ubuntu下安装失败的bug.
2022-09-01 19:41:19 +08:00
iOSHackers b89b180ee9 修复rsyncd在debian或ubuntu下安装失败的bug. 2022-09-01 19:21:52 +08:00
midoks 3e89c35111 Update phplib.conf 2022-08-31 23:22:34 +08:00
midoks 52f7939b06 Update phplib.conf 2022-08-31 23:21:39 +08:00
midoks 13d038e855 mysql,mariadb删除,不再支持程序删除。 2022-08-31 22:00:23 +08:00
midoks 325046d3c2 Update index.py 2022-08-31 21:53:59 +08:00
midoks 8cb3b578e0 Update index.py 2022-08-31 21:52:19 +08:00
midoks 3b5a5206fc Update index.py 2022-08-31 21:50:03 +08:00
Mr Chen 1517d8d2d7 Merge pull request #181 from midoks/dev
0.9.7
2022-08-29 13:15:36 +08:00
midoks ba55477492 up 2022-08-29 13:14:41 +08:00
midoks e363833437 Update install.sh 2022-08-29 13:12:37 +08:00
midoks 6ec51baedb Update install.sh 2022-08-29 12:48:28 +08:00
midoks 0fdf62499b Update index.py 2022-08-29 12:22:59 +08:00
midoks 1498e23b48 Update haproxy.js 2022-08-29 12:14:13 +08:00
midoks 106ce839d8 Update index.html 2022-08-29 12:13:40 +08:00
midoks eed561dadc Update haproxy.conf 2022-08-29 12:09:13 +08:00
midoks c97ec1cbba up 2022-08-29 12:08:02 +08:00
midoks 29802d8066 up 2022-08-29 11:32:29 +08:00
midoks 9a51bc4b4e Update index.py 2022-08-29 00:35:46 +08:00
midoks 082f697706 Update index.py 2022-08-29 00:34:58 +08:00
midoks 6e026f2998 Update install.sh 2022-08-28 23:35:31 +08:00
midoks c647f0c02d Update haproxy.tpl 2022-08-28 23:26:02 +08:00
midoks da99297253 Update haproxy.service.tpl 2022-08-28 23:25:31 +08:00
midoks 4ab982827e 优化 2022-08-28 23:02:37 +08:00
midoks d3a4db511a haproxy init 2022-08-28 22:50:17 +08:00
midoks fa9e4e3b06 Update index.py 2022-08-24 15:31:44 +08:00
midoks e7cd941f0f Update index.py 2022-08-24 15:16:59 +08:00
midoks c641606ecd #175
统计流量区分类型
2022-08-23 11:13:44 +08:00
Mr Chen 021a360462 Merge pull request #177 from midoks/dev
优化getLocalIp方法
2022-08-23 07:37:59 +08:00
midoks 9104280ff1 不再全部测试 2022-08-23 07:37:11 +08:00
midoks 0ea0f2d13d 优化getLocalIp方法 2022-08-23 07:35:34 +08:00
Mr Chen 289e251480 Merge pull request #176 from midoks/dev
php74版本退回
2022-08-23 07:03:14 +08:00
midoks ce421cfb89 Update install.sh 2022-08-23 06:52:54 +08:00
Mr Chen bec41f2c63 Merge pull request #174 from midoks/dev
代码改变版本号
2022-08-22 13:28:50 +08:00
midoks 3a34974ec9 Update config_api.py 2022-08-22 13:26:48 +08:00
midoks a7c9fff283 up 2022-08-22 11:55:30 +08:00
midoks c36cca61a1 Update centos.sh 2022-08-22 11:52:05 +08:00
Mr Chen 42edf12d01 Merge pull request #172 from midoks/dev
0.9.6
2022-08-22 11:44:39 +08:00
midoks d6799e89c4 0.9.6 2022-08-22 11:43:11 +08:00
midoks 4b4006c9da Update index.html 2022-08-21 12:23:39 +08:00
midoks 33bb042b41 up 2022-08-17 19:16:51 +08:00
midoks be2e91b9ce mariadb up 2022-08-17 19:14:36 +08:00
midoks db424f8912 mariadb up 2022-08-17 19:12:12 +08:00
midoks bfca2e313a Update rsyncd.js 2022-08-17 12:01:28 +08:00
midoks 1de51747e6 Update supervisor.js 2022-08-17 09:28:25 +08:00
midoks 8a623b490b supervisor增加错误查看 2022-08-17 09:25:08 +08:00
midoks b5b8ef7e46 Update .gitignore 2022-08-16 22:08:07 +08:00
midoks daa561b6c4 Update README.md 2022-08-16 18:42:03 +08:00
midoks 9bc30db1ad Update README.md 2022-08-16 18:38:35 +08:00
midoks 1a9d506d61 Update README.md 2022-08-16 18:35:29 +08:00
midoks 62b5d812e2 Update install.sh 2022-08-16 17:29:10 +08:00
midoks 433c9ab5ea Update files_api.py 2022-08-16 11:51:46 +08:00
midoks a7a6976204 增加插件[备份]功能。
1. json: "hook":["backup"]   -- 备份钩子开启
2.crontab的执行周期添加优化。
2022-08-16 04:45:21 +08:00
Mr Chen a1d8523dd9 Merge pull request #165 from midoks/dev
0.9.5
2022-08-15 19:39:36 +08:00
midoks 295e456a20 Update README.md 2022-08-15 19:38:32 +08:00
midoks 453cb4cf14 0.9.5 2022-08-15 19:37:59 +08:00
midoks 56a1ffed2a Update index.py 2022-08-15 16:14:46 +08:00
midoks b94f302fbe gogs 提示更人性 2022-08-15 13:41:01 +08:00
midoks 3a278f4cc6 Update system_api.py 2022-08-15 13:04:52 +08:00
midoks 67b7f9cf43 Update system_api.py 2022-08-15 13:04:32 +08:00
midoks b3dc24428c Update system_api.py 2022-08-15 12:48:29 +08:00
midoks 233e6dfc0f 密码字符修复2 2022-08-15 00:17:27 +08:00
midoks 07e74a8947 密码字符修复。 2022-08-14 22:52:25 +08:00
midoks 4eed1e8a93 Update index.py 2022-08-14 20:53:15 +08:00
midoks 1b91af6f22 Update install.sh 2022-08-14 20:32:42 +08:00
midoks 9bc824906b Update index.py 2022-08-14 20:16:24 +08:00
midoks 394f345764 Update index.py 2022-08-14 20:13:36 +08:00
midoks a10a11817b Update install.sh 2022-08-14 20:11:36 +08:00
midoks 6b82dd5eca Update index.py 2022-08-14 20:04:44 +08:00
midoks a5d976ad36 Update install.sh 2022-08-14 19:43:49 +08:00
midoks 4bb4746a1b Update redis.sh 2022-08-14 18:08:39 +08:00
midoks 9fad06585f Squashed commit of the following:
commit 0cf35955d8
Merge: f99225f1 7fe6744c
Author: midoks <midoks@163.com>
Date:   Sun Aug 14 15:44:39 2022 +0800

    Merge branch 'master' of github.com:midoks/mdserver-web

commit 7fe6744c09
Merge: cd9b0435 beb085e9
Author: Mr Chen <midoks@users.noreply.github.com>
Date:   Sun Aug 14 15:27:42 2022 +0800

    Merge pull request #163 from WankkoRee/master

    修正`MariaDB 10.8`安装后显示为`MariaDB 10.7`的问题

commit beb085e95c
Author: Wankko Ree <wkr@wkr.moe>
Date:   Sun Aug 14 15:19:55 2022 +0800

    修正`MariaDB 10.8`安装后显示为`MariaDB 10.7`的问题
2022-08-14 15:44:53 +08:00
midoks 50ed66d26a Merge branch 'master' into dev 2022-08-14 15:42:11 +08:00
midoks ed17622a0b MySQL&MariaDB导入修复 2022-08-14 15:35:59 +08:00
midoks b8e993cd04 Update index.py 2022-08-14 15:33:08 +08:00
Mr Chen 7fe6744c09 Merge pull request #163 from WankkoRee/master
修正`MariaDB 10.8`安装后显示为`MariaDB 10.7`的问题
2022-08-14 15:27:42 +08:00
Wankko Ree beb085e95c 修正MariaDB 10.8安装后显示为MariaDB 10.7的问题 2022-08-14 15:20:34 +08:00
midoks 657f408a8b Update system_api.py 2022-08-14 10:43:39 +08:00
midoks 3994f1505e Update system_api.py 2022-08-14 10:18:09 +08:00
midoks 0ecc9307f1 Update site_api.py 2022-08-14 10:17:56 +08:00
midoks 93de3dd3ab Update system_api.py 2022-08-14 00:47:39 +08:00
midoks f99225f172 Update system_api.py 2022-08-14 00:46:44 +08:00
Mr Chen cd9b043525 Merge pull request #161 from midoks/dev
0.9.4[2]
2022-08-13 23:58:03 +08:00
midoks 0e5c59dae2 Update config_api.py 2022-08-13 23:56:52 +08:00
Mr Chen 1a5c7b9a3f Merge pull request #160 from midoks/dev
0.9.4
2022-08-13 23:50:46 +08:00
midoks 2282776020 Update README.md 2022-08-13 23:49:37 +08:00
midoks cd2b07f5d2 0.9.4 2022-08-13 23:28:06 +08:00
midoks a5d4d53883 waf 修复 2022-08-13 22:30:30 +08:00
midoks 9e463cec7a 防止信息泄露 2022-08-13 19:27:49 +08:00
midoks e489bd43b8 phpmyadmin访问优化 2022-08-13 19:14:55 +08:00
midoks 983eb38165 mariadb 用户优化 2022-08-13 18:35:30 +08:00
midoks 677894ca35 Update ubuntu.sh 2022-08-13 18:17:49 +08:00
midoks a302ded8b2 Update debian.sh 2022-08-13 17:35:44 +08:00
midoks 3eeee10de6 Update index.py 2022-08-13 15:16:16 +08:00
midoks 160998ba6e Update phpmyadmin.js 2022-08-13 15:13:41 +08:00
midoks 8ece38c082 phpmyadmin支持mariadb。并默认开启安全验证。 2022-08-13 15:12:04 +08:00
midoks 52d4215a80 Update mw-cli 2022-08-13 14:45:26 +08:00
midoks 029b548af0 Update info.json 2022-08-13 10:44:20 +08:00
midoks 4db10d22a7 修复网站密码设置 2022-08-13 09:42:12 +08:00
midoks 1d3ca158cb Merge branch 'master' into dev 2022-08-13 01:59:16 +08:00
midoks 74e19287e4 Merge branch 'master' into dev 2022-08-13 01:58:24 +08:00
Mr Chen ece8dd8b19 Merge pull request #159 from midoks/midoks-patch-1
Update README.md
2022-08-13 01:58:07 +08:00
Mr Chen d082297b25 Update README.md 2022-08-13 01:57:39 +08:00
89 changed files with 1919 additions and 435 deletions
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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
View File
@@ -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
+41 -11
View File
@@ -1,4 +1,10 @@
### mdserver-web 0.9.2
<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 |[![digitalvirt](https://digitalvirt.com/templates/BlueWhite/img/logo-dark.svg)](https://digitalvirt.com/aff.php?aff=154) | https://digitalvirt.com/aff.php?aff=154 | 9SYDY7UH0U |
| 搬瓦工 |[![搬瓦工](https://bwh81.net/templates/organicbandwagon/images/logo.png)](https://bandwagonhost.com/aff.php?aff=54161) | https://bandwagonhost.com/aff.php?aff=54161 | BWH3HYATVBJW |
# Docker
- 由[DDSRem](https://github.com/DDSRem)开发维护。
@@ -71,13 +86,19 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
```
### 版本更新 0.9.3
### 版本更新 0.9.9
* 更换Logo。
* 增加amazon linux系统支持。
* 修复rsyncd在debian或ubuntu下安装失败问题。
* Readme加入一AD。
* PHP-YUM|PHP-APT优化[性能调整]。
* 优化Gogs使用MySQL的方式。
* 配置模板添加一个whmcs。
* MySQL和MariaDB无法直接卸载。
* OpenResty加入http_realip_module模块。
* PHP加入igbinary扩展。
* 批量域名添加修复。
* 常用命令说明。
* 重写页面更新功能。
* MySQL8.0安装地址修改。
* 删除MySQL[Yum]插件。
### JSDelivr安装地址
@@ -123,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)](/route/static/img/weixin_zz.jpg)
[![截图](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/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)](/route/static/mdw.jpg)
[![截图](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/mdw.jpg)](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/mdw.jpg)
### Stargazers over time
@@ -142,7 +172,7 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/up
### 感谢开发赞助
[![digitalvirt](https://digitalvirt.com/templates/BlueWhite/img/logo-dark.svg)](https://digitalvirt.com/)
[![digitalvirt](https://digitalvirt.com/templates/BlueWhite/img/logo-dark.svg)](https://digitalvirt.com/aff.php?aff=154)
### 授权许可
+1 -1
View File
@@ -15,7 +15,7 @@ from flask import request
class config_api:
__version = '0.9.3'
__version = '0.9.9'
def __init__(self):
pass
+18 -11
View File
@@ -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:
+1 -2
View File
@@ -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
View File
@@ -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'
+53 -4
View File
@@ -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
+4 -4
View File
@@ -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, '证书不存在!')
@@ -1140,10 +1140,10 @@ class site_api:
if conf.find(rep) == -1:
rep = '#error_page 404/404.html;'
data = '''
# AUTH_START
#AUTH_START
auth_basic "Authorization";
auth_basic_user_file %s;
# AUTH_END''' % (filename,)
#AUTH_END''' % (filename,)
conf = conf.replace(rep, rep + data)
mw.writeFile(configFile, conf)
# 写密码配置
@@ -2026,7 +2026,7 @@ location ^~ {from} {
return 404;
}
}
# SECURITY-END
#SECURITY-END
include %s/enable-php-''' % (fix.strip().replace(',', '|'), domains.strip().replace(',', ' '), pre_path)
conf = re.sub(re_path, rconf, conf)
mw.writeLog('网站管理', '站点[' + name + ']已开启防盗链!')
+45 -41
View File
@@ -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, "设置成功!")
@@ -684,22 +687,23 @@ class system_api:
dist_mw = toPath + '/mw.zip'
if not os.path.exists(dist_mw):
mw.execShell('wget -O ' + dist_mw + ' ' + newUrl)
mw.execShell(
'wget --no-check-certificate -O ' + dist_mw + ' ' + newUrl)
dist_to = toPath + "/mdserver-web-" + version
if not os.path.exists(dist_to):
mw.execShell('unzip -o ' + toPath +
'/mw.zip' + ' -d ' + toPath)
os.system('unzip -o ' + toPath +
'/mw.zip' + ' -d ' + toPath)
cmd_cp = "cp -rf " + toPath + '/mdserver-web-' + \
version + "/* " + mw.getServerDir() + "/mdserver-web"
cmd_cp = 'cp -rf ' + toPath + '/mdserver-web-' + \
version + '/* ' + mw.getServerDir() + '/mdserver-web'
mw.execShell(cmd_cp)
mw.execShell('rm -rf ' + toPath + '/mdserver-web-' + version)
mw.execShell('rm -rf ' + toPath + '/mw.zip')
self.restartMw()
return mw.returnJson(True, '安装更新成功,需自己重启!')
return mw.returnJson(True, '安装更新成功!')
return mw.returnJson(False, '已经是最新,无需更新!')
except Exception as ex:
+11
View File
@@ -11,6 +11,7 @@ class ORM:
__DB_PASS = None
__DB_USER = 'root'
__DB_PORT = 3306
__DB_NAME = ''
__DB_HOST = 'localhost'
__DB_CONN = None
__DB_CUR = None
@@ -27,21 +28,25 @@ class ORM:
if os.path.exists(self.__DB_SOCKET):
try:
self.__DB_CONN = pymysql.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
database=self.__DB_NAME,
port=int(self.__DB_PORT), charset=self.__DB_CHARSET, connect_timeout=1,
unix_socket=self.__DB_SOCKET, cursorclass=pymysql.cursors.DictCursor)
except Exception as e:
self.__DB_HOST = '127.0.0.1'
self.__DB_CONN = pymysql.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
database=self.__DB_NAME,
port=int(self.__DB_PORT), charset=self.__DB_CHARSET, connect_timeout=1,
unix_socket=self.__DB_SOCKET, cursorclass=pymysql.cursors.DictCursor)
else:
try:
self.__DB_CONN = pymysql.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
database=self.__DB_NAME,
port=int(self.__DB_PORT), charset=self.__DB_CHARSET, connect_timeout=1,
cursorclass=pymysql.cursors.DictCursor)
except Exception as e:
self.__DB_HOST = '127.0.0.1'
self.__DB_CONN = pymysql.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
database=self.__DB_NAME,
port=int(self.__DB_PORT), charset=self.__DB_CHARSET, connect_timeout=1,
cursorclass=pymysql.cursors.DictCursor)
@@ -63,12 +68,18 @@ 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
def getPwd(self):
return self.__DB_PASS
def setDbName(self, name):
self.__DB_NAME = name
def execute(self, sql):
# 执行SQL语句返回受影响行
if not self.__Conn():
+6
View File
@@ -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():
+5
View File
@@ -48,6 +48,11 @@ def mw_reset_pwd():
if __name__ == '__main__':
if os.geteuid() != 0:
print("请使用root账户执行该命令.")
sys.exit(1)
os.chdir("/www/server/mdserver-web")
sys.path.append(os.getcwd() + "/class/core")
-91
View File
@@ -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()
+14 -14
View File
@@ -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):
@@ -388,7 +388,7 @@ def postReceiveLog():
def getGogsConf():
conf = getConf()
if not os.path.exists(conf):
return mw.returnJson(False, "请先安装初始化!")
return mw.returnJson(False, "请先安装初始化!<br/>默认地址:http://" + mw.getLocalIp() + ":3000")
gets = [
{'name': 'DOMAIN', 'type': -1, 'ps': '服务器域名'},
@@ -455,7 +455,7 @@ def userList():
conf = getConf()
if not os.path.exists(conf):
return mw.returnJson(False, "请先安装初始化!")
return mw.returnJson(False, "请先安装初始化!<br/>默认地址:http://" + mw.getLocalIp() + ":3000")
import math
args = getArgs()
@@ -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,
+2
View File
@@ -29,6 +29,8 @@ getBit(){
Install_gogs()
{
pip3 install mysqlclient
mkdir -p $serverPath/source/gogs
echo '正在安装脚本文件...' > $install_tmp
+4 -4
View File
@@ -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>';
}
+37
View File
@@ -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

+18
View File
@@ -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>
+253
View File
@@ -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')
+19
View File
@@ -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
+119
View File
@@ -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 $?
+52
View File
@@ -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
+53
View File
@@ -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;
}
+70
View File
@@ -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
+1 -1
View File
@@ -45,11 +45,11 @@ skip-name-resolve = on
log-bin=mysql-bin
binlog_format=mixed
expire_logs_days = 10
slow_query_log=1
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
long_query_time=3
#log_queries_not_using_indexes=on
binlog-expire-logs-seconds = 2592000
relay-log=mdserver
relay-log-index=mdserver
+47 -28
View File
@@ -150,7 +150,7 @@ def pSqliteDb(dbname='databases'):
return conn
def pMysqlDb():
def pMysqlDb(name=''):
# pymysql
db = mw.getMyORM()
# MySQLdb |
@@ -159,6 +159,7 @@ def pMysqlDb():
db.setDbConf(getConf())
db.setPort(getDbPort())
db.setSocket(getSocketFile())
db.setDbName(name)
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
db.setPwd(pwd)
@@ -631,7 +632,7 @@ def isSqlError(mysqlMsg):
def __createUser(dbname, username, password, address):
pdb = pMysqlDb()
pdb = pMysqlDb('mysql')
if username == 'root':
dbname = '*'
@@ -691,8 +692,8 @@ def importDbBackup():
mw.execShell(cmd)
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
mysql_cmd = mw.getRootDir() + '/server/mysql/bin/mysql -uroot -p' + pwd + \
sock = getSocketFile()
mysql_cmd = getServerDir() + '/bin/mysql -S ' + sock + ' -uroot -p' + pwd + \
' ' + name + ' < ' + file_path_sql
# print(mysql_cmd)
@@ -797,7 +798,7 @@ def syncGetDatabases():
if isError != None:
return isError
users = pdb.query(
"select User,Host from mysql.user where User!='root' AND Host!='localhost' AND Host!=''")
"select User,Host from user where User!='root' AND Host!='localhost' AND Host!=''")
nameArr = ['information_schema', 'performance_schema', 'mysql', 'sys']
n = 0
@@ -893,16 +894,19 @@ def setRootPwd(version=''):
password = args['password']
try:
pdb = pMysqlDb()
pdb = pMysqlDb('mysql')
result = pdb.query("show databases")
isError = isSqlError(result)
if isError != None:
return isError
result = pdb.execute(
"update mysql.user set Password=password('" + password + "') where User='root'")
pdb.execute("flush privileges")
cmd = "ALTER USER 'root'@'localhost' IDENTIFIED BY '" + password + "';"
r = pdb.execute(cmd)
# print(r)
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (password,))
orm = pMysqlDb()
orm.execute("flush privileges")
return mw.returnJson(True, '数据库root密码修改成功!')
except Exception as ex:
return mw.returnJson(False, '修改错误:' + str(ex))
@@ -910,7 +914,7 @@ def setRootPwd(version=''):
def setUserPwd(version=''):
args = getArgs()
data = checkArgs(args, ['password', 'name'])
data = checkArgs(args, ['password', 'name', 'id'])
if not data[0]:
return data[1]
@@ -920,16 +924,28 @@ def setUserPwd(version=''):
try:
pdb = pMysqlDb()
psdb = pSqliteDb('databases')
name = psdb.where('id=?', (uid,)).getField('name')
data = psdb.field('id,name,accept').where('id=?', (uid,)).find()
result = pdb.execute("update mysql.user set Password=password('" +
newpassword + "') where User='" + username + "'")
cmd = "SET PASSWORD FOR '" + username + \
"'@'localhost' = PASSWORD('" + newpassword + "')"
r = pdb.execute(cmd)
# print(cmd, r)
accept = data['accept']
alist = accept.split(',')
for x in alist:
cmd = "SET PASSWORD FOR '" + username + \
"'@'" + x + "' = PASSWORD('" + newpassword + "')"
r = pdb.execute(cmd)
# print(cmd, r)
pdb.execute("flush privileges")
psdb.where("id=?", (uid,)).setField('password', newpassword)
return mw.returnJson(True, mw.getInfo('修改数据库[{1}]密码成功!', (name,)))
orm = pMysqlDb()
orm.execute("flush privileges")
return mw.returnJson(True, mw.getInfo('修改数据库[{1}]密码成功!', (data['name'],)))
except Exception as ex:
return mw.returnJson(False, mw.getInfo('修改数据库[{1}]密码失败[{2}]!', (name, str(ex),)))
return mw.returnJson(False, mw.getInfo('修改数据库[{1}]密码失败[{2}]!', (data['name'], str(ex),)))
def setDbPs():
@@ -1022,7 +1038,7 @@ def delDb():
id = args['id']
name = args['name']
psdb = pSqliteDb('databases')
pdb = pMysqlDb()
pdb = pMysqlDb('mysql')
find = psdb.where("id=?", (id,)).field(
'id,pid,name,username,password,accept,ps,addtime').find()
accept = find['accept']
@@ -1031,7 +1047,7 @@ def delDb():
# 删除MYSQL
result = pdb.execute("drop database `" + name + "`")
users = pdb.query("select Host from mysql.user where User='" +
users = pdb.query("select Host from user where User='" +
username + "' AND Host!='localhost'")
pdb.execute("drop user '" + username + "'@'localhost'")
for us in users:
@@ -1051,9 +1067,9 @@ def getDbAccess():
if not data[0]:
return data[1]
username = args['username']
pdb = pMysqlDb()
pdb = pMysqlDb('mysql')
users = pdb.query("select Host from mysql.user where User='" +
users = pdb.query("select Host from user where User='" +
username + "' AND Host!='localhost'")
if len(users) < 1:
@@ -1072,7 +1088,7 @@ def setDbAccess():
return data[1]
name = args['username']
access = args['access']
pdb = pMysqlDb()
pdb = pMysqlDb('mysql')
psdb = pSqliteDb('databases')
dbname = psdb.where('username=?', (name,)).getField('name')
@@ -1083,7 +1099,7 @@ def setDbAccess():
else:
password = psdb.where("username=?", (name,)).getField('password')
users = pdb.query("select Host from mysql.user where User='" +
users = pdb.query("select Host from user where User='" +
name + "' AND Host!='localhost'")
for us in users:
@@ -1105,11 +1121,11 @@ def setDbRw(version=''):
uid = args['id']
rw = args['rw']
pdb = pMysqlDb()
pdb = pMysqlDb('mysql')
psdb = pSqliteDb('databases')
dbname = psdb.where("id=?", (uid,)).getField('name')
users = pdb.query(
"select Host from mysql.user where User='" + username + "'")
"select Host from user where User='" + username + "'")
# show grants for demo@"127.0.0.1";
for x in users:
@@ -1374,7 +1390,7 @@ def setDbMasterAccess():
pdb = pMysqlDb()
psdb = pSqliteDb('master_replication_user')
password = psdb.where("username=?", (username,)).getField('password')
users = pdb.query("select Host from mysql.user where User='" +
users = pdb.query("select Host from user where User='" +
username + "' AND Host!='localhost'")
for us in users:
pdb.execute("drop user '" + username + "'@'" + us["Host"] + "'")
@@ -1706,7 +1722,7 @@ def delMasterRepSlaveUser(version=''):
pdb.execute("drop user '" + name + "'@'%'")
pdb.execute("drop user '" + name + "'@'localhost'")
users = pdb.query("select Host from mysql.user where User='" +
users = pdb.query("select Host from user where User='" +
name + "' AND Host!='localhost'")
for us in users:
pdb.execute("drop user '" + name + "'@'" + us["Host"] + "'")
@@ -2164,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]
+26 -18
View File
@@ -445,10 +445,9 @@ function syncToDatabase(type){
function setRootPwd(type, pwd){
if (type==1){
var data = $("#mod_pwd").serialize();
myPost('set_root_pwd', data, function(data){
var password = $("#MyPassword").val();
myPost('set_root_pwd', {password:password}, function(data){
var rdata = $.parseJSON(data.data);
// console.log(rdata);
showMsg(rdata.msg,function(){
dbList();
$('.layui-layer-close1').click();
@@ -459,26 +458,23 @@ function setRootPwd(type, pwd){
var index = layer.open({
type: 1,
skin: 'demo-class',
area: '500px',
title: '修改数据库密码',
closeBtn: 1,
shift: 5,
btn:["提交","关闭"],
shadeClose: true,
content: "<form class='bt-form pd20 pb70' id='mod_pwd'>\
content: "<form class='bt-form pd20' id='mod_pwd'>\
<div class='line'>\
<span class='tname'>root密码</span>\
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+pwd+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
</div>\
<div class='bt-form-submit-btn'>\
<button id='my_mod_close' type='button' class='btn btn-danger btn-sm btn-title'>关闭</button>\
<button type='button' class='btn btn-success btn-sm btn-title' onclick=\"setRootPwd(1)\" >提交</button>\
<span class='tname'>root密码</span>\
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+pwd+"' />\
<span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span>\
</div>\
</div>\
</form>",
});
$('#my_mod_close').click(function(){
$('.layui-layer-close1').click();
yes:function(){
setRootPwd(1);
}
});
}
@@ -632,12 +628,17 @@ function setDbPass(id, username, password){
</div>\
<div class='line'>\
<span class='tname'>密码</span>\
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+password+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
<div class='info-r'>\
<input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+password+"' />\
<span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
</div>\
<input type='hidden' name='id' value='"+id+"'>\
</form>",
yes:function(index){
var data = $("#mod_pwd").serialize();
var data = {};
data['name'] = $('input[name=name]').val();
data['password'] = $('#MyPassword').val();
data['id'] = $('input[name=id]').val();
myPost('set_user_pwd', data, function(data){
var rdata = $.parseJSON(data.data);
showMsg(rdata.msg,function(){
@@ -809,7 +810,14 @@ function openPhpmyadmin(name,username,password){
layer.msg('phpMyAdmin未启动',{icon:2,shade: [0.3, '#000']});
return;
}
// console.log(data);
data = syncPost('/plugins/run',{'name':'phpmyadmin','func':'get_cfg'});
var rdata = $.parseJSON(data.data);
if (rdata.choose != 'mariadb'){
layer.msg('当前为['+rdata.choose+']模式,若要使用请切换模式.',{icon:2,shade: [0.3, '#000']});
return;
}
data = syncPost('/plugins/run',{'name':'phpmyadmin','func':'get_home_page'});
var rdata = $.parseJSON(data.data);
if (!rdata.status){
+16 -6
View File
@@ -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
@@ -71,10 +76,15 @@ Install_app()
if [ "$sysName" == "Darwin" ];then
OPTIONS='-DPLUGIN_TOKUDB=NO'
fi
INSTALL_CMD=cmake
CMAKE3=`which cmake3`
if [ "$?" == "0" ];then
INSTALL_CMD=cmake3
fi
if [ ! -d $serverPath/mariadb ];then
cd ${mariadbDir}/mariadb-${MY_VER} && cmake \
cd ${mariadbDir}/mariadb-${MY_VER} && $INSTALL_CMD \
-DCMAKE_INSTALL_PREFIX=$serverPath/mariadb \
-DMYSQL_DATADIR=$serverPath/mariadb/data/ \
-DMYSQL_USER=mysql \
+6 -4
View File
@@ -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 \
+7 -4
View File
@@ -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
@@ -86,7 +89,7 @@ Install_app()
make -j${cpuCore} && make install && make clean
if [ -d $serverPath/mariadb ];then
echo '10.7' > $serverPath/mariadb/version.pl
echo '10.8' > $serverPath/mariadb/version.pl
echo '安装完成' > $install_tmp
else
# rm -rf ${mariadbDir}/mariadb-${MY_VER}
+16 -4
View File
@@ -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
}
+1 -1
View File
@@ -53,7 +53,7 @@
.conf_p span {
display: inline-block;
margin-right: 10px;
width: 95px;
width: 135px;
text-align: right;
}
</style>
+7 -4
View File
@@ -821,8 +821,8 @@ def importDbBackup():
mw.execShell(cmd)
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
mysql_cmd = mw.getRootDir() + '/server/mysql/bin/mysql -uroot -p' + pwd + \
sock = getSocketFile()
mysql_cmd = getServerDir() + '/bin/mysql -S ' + sock + ' -uroot -p' + pwd + \
' ' + name + ' < ' + file_path_sql
# print(mysql_cmd)
@@ -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]
+27 -17
View File
@@ -445,10 +445,9 @@ function syncToDatabase(type){
function setRootPwd(type, pwd){
if (type==1){
var data = $("#mod_pwd").serialize();
myPost('set_root_pwd', data, function(data){
var password = $("#MyPassword").val();
myPost('set_root_pwd', {password:password}, function(data){
var rdata = $.parseJSON(data.data);
// console.log(rdata);
showMsg(rdata.msg,function(){
dbList();
$('.layui-layer-close1').click();
@@ -459,26 +458,23 @@ function setRootPwd(type, pwd){
var index = layer.open({
type: 1,
skin: 'demo-class',
area: '500px',
title: '修改数据库密码',
closeBtn: 1,
shift: 5,
btn:["提交","关闭"],
shadeClose: true,
content: "<form class='bt-form pd20 pb70' id='mod_pwd'>\
content: "<form class='bt-form pd20' id='mod_pwd'>\
<div class='line'>\
<span class='tname'>root密码</span>\
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+pwd+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
</div>\
<div class='bt-form-submit-btn'>\
<button id='my_mod_close' type='button' class='btn btn-danger btn-sm btn-title'>关闭</button>\
<button type='button' class='btn btn-success btn-sm btn-title' onclick=\"setRootPwd(1)\" >提交</button>\
<span class='tname'>root密码</span>\
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+pwd+"' />\
<span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span>\
</div>\
</div>\
</form>",
});
$('#my_mod_close').click(function(){
$('.layui-layer-close1').click();
yes:function(){
setRootPwd(1);
}
});
}
@@ -632,12 +628,18 @@ function setDbPass(id, username, password){
</div>\
<div class='line'>\
<span class='tname'>密码</span>\
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+password+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
<div class='info-r'>\
<input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+password+"' />\
<span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
</div>\
<input type='hidden' name='id' value='"+id+"'>\
</form>",
yes:function(index){
var data = $("#mod_pwd").serialize();
// var data = $("#mod_pwd").serialize();
var data = {};
data['name'] = $('input[name=name]').val();
data['password'] = $('#MyPassword').val();
data['id'] = $('input[name=id]').val();
myPost('set_user_pwd', data, function(data){
var rdata = $.parseJSON(data.data);
showMsg(rdata.msg,function(){
@@ -809,6 +811,14 @@ function openPhpmyadmin(name,username,password){
layer.msg('phpMyAdmin未启动',{icon:2,shade: [0.3, '#000']});
return;
}
data = syncPost('/plugins/run',{'name':'phpmyadmin','func':'get_cfg'});
var rdata = $.parseJSON(data.data);
if (rdata.choose == 'mariadb'){
layer.msg('当前为[mariadb]模式,若要使用请切换模式.',{icon:2,shade: [0.3, '#000']});
return;
}
// console.log(data);
data = syncPost('/plugins/run',{'name':'phpmyadmin','func':'get_home_page'});
var rdata = $.parseJSON(data.data);
+32
View File
@@ -12,6 +12,37 @@ config = C:read_file_body_decode(cpath .. 'config.json')
local site_config = C:read_file_body_decode(cpath .. 'site.json')
C:setConfData(config, site_config)
-- D func
local function D(msg)
local _msg = ''
if type(msg) == 'table' then
for key, val in pairs(msg) do
_msg = key..':'..val.."\n"
end
elseif type(msg) == 'string' then
_msg = msg
elseif type(msg) == 'nil' then
_msg = 'nil'
else
_msg = msg
end
if not debug_mode then return true end
local fp = io.open(cpath..'debug.log', 'ab')
if fp == nil then
return nil
end
local localtime = os.date("%Y-%m-%d %H:%M:%S")
if server_name then
fp:write(tostring(_msg) .. "\n")
else
fp:write(localtime..":"..tostring(_msg) .. "\n")
end
fp:flush()
fp:close()
return true
end
function initParams()
local data = {}
data['ip'] = C:get_client_ip()
@@ -314,6 +345,7 @@ end
function post_data_chekc()
if params['method'] =="POST" then
if C:return_post_data() then return false end
ngx.req.read_body()
request_args = ngx.req.get_post_args()
if not request_args then return false end
+3 -1
View File
@@ -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
+3 -3
View File
@@ -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}',
+20
View File
@@ -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"
+4 -4
View File
@@ -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,
+20
View File
@@ -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": [
+1 -1
View File
@@ -146,7 +146,7 @@ def contentReplace(content, version):
def makeOpenrestyConf():
phpversions = ['00', '52', '53', '54', '55', '56',
'70', '71', '72', '73', '74', '80', '81']
'70', '71', '72', '73', '74', '80', '81', '82']
sdir = mw.getServerDir()
+5 -1
View File
@@ -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}
+1 -1
View File
@@ -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()
{
+1 -1
View File
@@ -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()
{
+1 -1
View File
@@ -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()
{
+109
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -12,7 +12,7 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
LIBNAME=redis
LIBV=5.3.7
LIBV=5.3.6
sysName=`uname`
actionType=$1
version=$2
+1 -1
View File
@@ -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
+17
View File
@@ -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": [
+2 -1
View File
@@ -2,10 +2,11 @@
$cfg['blowfish_secret'] = '{$BLOWFISH_SECRET}';
$i = 0;
$i++;
$cfg['Servers'][$i]['verbose'] = '{$CHOOSE_DB}';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
// $cfg['Servers'][$i]['host'] = '127.0.0.1';
// $cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['socket'] = '{$SERVER_PATH}/mysql/mysql.sock';
$cfg['Servers'][$i]['socket'] = '{$SERVER_PATH}/{$CHOOSE_DB_DIR}/mysql.sock';
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
+6 -1
View File
@@ -8,6 +8,11 @@ server
#error_page 404 /404.html;
include {$PHP_CONF_PATH}/enable-php-{$PHP_VER}.conf;
#AUTH_START
auth_basic "Authorization";
auth_basic_user_file {$SERVER_PATH}/phpmyadmin/pma.pass;
#AUTH_END
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
@@ -18,7 +23,7 @@ server
expires 12h;
}
location ~ /.*\.log$ {
location ~ /.*\.(log|pass|json|pl)$ {
deny all;
}
+137 -6
View File
@@ -5,6 +5,7 @@ import io
import os
import time
import re
import json
sys.path.append(os.getcwd() + "/class/core")
import mw
@@ -44,6 +45,13 @@ def getArgs():
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 getConf():
return mw.getServerDir() + '/web_conf/nginx/vhost/phpmyadmin.conf'
@@ -107,9 +115,50 @@ def contentReplace(content):
content = content.replace('{$PHP_CONF_PATH}', php_conf_dir)
content = content.replace('{$PHP_VER}', php_ver)
content = content.replace('{$BLOWFISH_SECRET}', blowfish_secret)
cfg = getCfg()
if (cfg['choose'] == ""):
content = content.replace('{$CHOOSE_DB}', 'mysql')
content = content.replace('{$CHOOSE_DB_DIR}', 'mysql')
else:
content = content.replace('{$CHOOSE_DB}', 'MariaDB')
content = content.replace('{$CHOOSE_DB_DIR}', 'mariadb')
return content
def initCfg():
cfg = getServerDir() + "/cfg.json"
if not os.path.exists(cfg):
data = {}
data['port'] = '888'
data['choose'] = ''
data['username'] = 'admin'
data['password'] = 'admin'
mw.writeFile(cfg, json.dumps(data))
def setCfg(key, val):
cfg = getServerDir() + "/cfg.json"
data = mw.readFile(cfg)
data = json.loads(data)
data[key] = val
mw.writeFile(cfg, json.dumps(data))
def getCfg():
cfg = getServerDir() + "/cfg.json"
data = mw.readFile(cfg)
data = json.loads(data)
return data
def returnCfg():
cfg = getServerDir() + "/cfg.json"
data = mw.readFile(cfg)
return data
def status():
conf = getConf()
conf_inc = getServerDir() + '/phpmyadmin/config.inc.php'
@@ -120,6 +169,8 @@ def status():
def start():
initCfg()
file_tpl = getPluginDir() + '/conf/phpmyadmin.conf'
file_run = getConf()
@@ -128,6 +179,14 @@ def start():
centent = contentReplace(centent)
mw.writeFile(file_run, centent)
pma_path = getServerDir() + '/pma.pass'
if not os.path.exists(pma_path):
username = mw.getRandomString(10)
pass_cmd = username + ':' + mw.hasPwd(username)
setCfg('username', username)
setCfg('password', username)
mw.writeFile(pma_path, pass_cmd)
tmp = getServerDir() + '/phpmyadmin/tmp'
if not os.path.exists(tmp):
os.mkdir(tmp)
@@ -179,12 +238,11 @@ def setPhpVer():
file_tpl = getPluginDir() + '/conf/phpmyadmin.conf'
file_run = getConf()
centent = mw.readFile(file_tpl)
centent = contentReplace(centent)
mw.writeFile(file_run, centent)
content = mw.readFile(file_tpl)
content = contentReplace(content)
mw.writeFile(file_run, content)
mw.restartWeb()
return 'ok'
@@ -195,6 +253,11 @@ def getSetPhpVer():
return ''
def getPmaOption():
data = getCfg()
return mw.returnJson(True, 'ok', data)
def getPmaPort():
try:
port = getPort()
@@ -206,8 +269,9 @@ def getPmaPort():
def setPmaPort():
args = getArgs()
if not 'port' in args:
return mw.returnJson(False, 'port missing!')
data = checkArgs(args, ['port'])
if not data[0]:
return data[1]
port = args['port']
if port == '80':
@@ -224,6 +288,63 @@ def setPmaPort():
return mw.returnJson(True, '修改成功!')
def setPmaChoose():
args = getArgs()
data = checkArgs(args, ['choose'])
if not data[0]:
return data[1]
choose = args['choose']
setCfg('choose', choose)
conf_run = getServerDir() + '/phpmyadmin/config.inc.php'
conf_tpl = getPluginDir() + '/conf/config.inc.php'
centent = mw.readFile(conf_tpl)
centent = contentReplace(centent)
mw.writeFile(conf_run, centent)
mw.restartWeb()
return mw.returnJson(True, '修改成功!')
def setPmaUsername():
args = getArgs()
data = checkArgs(args, ['username'])
if not data[0]:
return data[1]
username = args['username']
setCfg('username', username)
cfg = getCfg()
pma_path = getServerDir() + '/pma.pass'
username = mw.getRandomString(10)
pass_cmd = cfg['username'] + ':' + mw.hasPwd(cfg['password'])
mw.writeFile(pma_path, pass_cmd)
mw.restartWeb()
return mw.returnJson(True, '修改成功!')
def setPmaPassword():
args = getArgs()
data = checkArgs(args, ['password'])
if not data[0]:
return data[1]
password = args['password']
setCfg('password', password)
cfg = getCfg()
pma_path = getServerDir() + '/pma.pass'
username = mw.getRandomString(10)
pass_cmd = cfg['username'] + ':' + mw.hasPwd(cfg['password'])
mw.writeFile(pma_path, pass_cmd)
mw.restartWeb()
return mw.returnJson(True, '修改成功!')
def accessLog():
return getServerDir() + '/access.log'
@@ -252,6 +373,8 @@ if __name__ == "__main__":
print(getConf())
elif func == 'version':
print(Version())
elif func == 'get_cfg':
print(returnCfg())
elif func == 'config_inc':
print(getConfInc())
elif func == 'get_home_page':
@@ -264,6 +387,14 @@ if __name__ == "__main__":
print(getPmaPort())
elif func == 'set_pma_port':
print(setPmaPort())
elif func == 'get_pma_option':
print(getPmaOption())
elif func == 'set_pma_choose':
print(setPmaChoose())
elif func == 'set_pma_username':
print(setPmaUsername())
elif func == 'set_pma_password':
print(setPmaPassword())
elif func == 'access_log':
print(accessLog())
elif func == 'error_log':
+56 -12
View File
@@ -90,24 +90,68 @@ function phpVerChange(type, msg) {
//phpmyadmin安全设置
function safeConf() {
var data = pmaAsyncPost('get_pma_port');
var rdata = $.parseJSON(data.data);
if (!rdata.status){
layer.msg(rdata.msg,{icon:2,time:2000,shade: [0.3, '#000']});
return;
}
var con = '<div class="ver line">\
<span style="margin-right:10px">访问端口</span>\
<input class="bt-input-text phpmyadmindk mr20" name="Name" id="pmport" value="' + rdata['data'] + '" placeholder="phpmyadmin访问端口" maxlength="5" type="number">\
<button class="btn btn-success btn-sm" onclick="phpmyadminPort()">保存</button>\
pmaPost('get_pma_option', {}, function(rdata){
var rdata = $.parseJSON(rdata.data);
if (!rdata.status){
layer.msg(rdata.msg,{icon:2,time:2000,shade: [0.3, '#000']});
return;
}
var cfg = rdata.data;
var con = '<div class="ver line">\
<span class="tname">访问端口</span>\
<input style="width:110px" class="bt-input-text phpmyadmindk mr20" name="Name" id="pmport" value="' + cfg['port'] + '" placeholder="phpmyadmin访问端口" maxlength="5" type="number">\
<button class="btn btn-success btn-sm" onclick="setPamPort()">保存</button>\
</div>\
<div class="ver line">\
<span class="tname">访问切换</span>\
<select id="access_choose" class="bt-input-text mr20" name="choose" style="width:110px">\
<option value="mariadb" '+(cfg['choose']=="mariadb"?"selected='selected'":"")+'>MariaDB</option>\
<option value="mysql" '+ (cfg['choose']==""?"selected='selected'":"")+'>MySQL</option>\
</select>\
<button class="btn btn-success btn-sm" onclick="setPmaChoose()">保存</button>\
</div>\
<div class="ver line">\
<span class="tname">用户名</span>\
<input style="width:110px" class="bt-input-text mr20" name="username" id="pmport" value="' + cfg['username'] + '" placeholder="认证用户名" type="text">\
<button class="btn btn-success btn-sm" onclick="setPmaUsername()">保存</button>\
</div>\
<div class="ver line">\
<span class="tname">密码</span>\
<input style="width:110px" class="bt-input-text mr20" name="password" id="pmport" value="' + cfg['password'] + '" placeholder="密码" type="text">\
<button class="btn btn-success btn-sm" onclick="setPmaPassword()">保存</button>\
</div>';
$(".soft-man-con").html(con);
$(".soft-man-con").html(con);
});
}
function setPmaChoose(){
var choose = $("#access_choose").val();
pmaPost('set_pma_choose',{'choose':choose}, function(data){
var rdata = $.parseJSON(data.data);
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
});
}
function setPmaUsername(){
var username = $("input[name=username]").val();
pmaPost('set_pma_username',{'username':username}, function(data){
var rdata = $.parseJSON(data.data);
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
});
}
function setPmaPassword(){
var password = $("input[name=password]").val();
pmaPost('set_pma_password',{'password':password}, function(data){
var rdata = $.parseJSON(data.data);
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
});
}
//修改phpmyadmin端口
function phpmyadminPort() {
function setPamPort() {
var pmport = $("#pmport").val();
if (pmport < 80 || pmport > 65535) {
layer.msg('端口范围不合法!', { icon: 2 });
+2 -2
View File
@@ -4,8 +4,8 @@
"name": "redis",
"title": "Redis",
"shell": "install.sh",
"versions":["4.0.11","5.0.8","6.0.4","6.2.7"],
"updates":["4.0.11","5.0.8","6.0.4","6.2.7"],
"versions":["4.0.11","5.0.8","6.0.4","6.2.7","7.0.4"],
"updates":["4.0.11","5.0.8","6.0.4","6.2.7","7.0.4"],
"tip": "soft",
"checks": "server/redis",
"path": "server/redis",
+5 -2
View File
@@ -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):
+1 -1
View File
@@ -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
+4 -1
View File
@@ -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;
}
});
+25 -1
View File
@@ -56,7 +56,7 @@ def getArgs():
tmp[t[0]] = t[1]
elif args_len > 1:
for i in range(len(args)):
t = args[i].split(':')
t = args[i].split(':', 1)
tmp[t[0]] = t[1]
return tmp
@@ -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':
+20 -3
View File
@@ -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);
///
});
+43
View File
@@ -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
View File
@@ -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 -1
View File
@@ -1,4 +1,4 @@
location /{
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php/$1 last;
break;
+8
View File
@@ -3,3 +3,11 @@ location / {
rewrite ^(.*)$ /index.php$1 last;
}
}
# 不需要,可以删除
location /typecho/ {
if (!-e $request_filename) {
rewrite ^(.*)$ /typecho/index.php$1 last;
}
}
-5
View File
@@ -1,5 +0,0 @@
location /typecho/ {
if (!-e $request_filename) {
rewrite ^(.*)$ /typecho/index.php$1 last;
}
}
+16
View File
@@ -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;
}
}
-9
View File
@@ -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
View File
@@ -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
View File
@@ -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

+11 -5
View File
@@ -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>
+3
View File
@@ -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
+166
View File
@@ -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
+1 -2
View File
@@ -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;
+1
View File
@@ -17,6 +17,7 @@ if grep -Eq "Debian" /etc/*-release; then
fi
apt update -y
apt-get update -y
apt install -y wget curl lsof unzip
+1
View File
@@ -10,6 +10,7 @@ fi
apt update -y
apt-get update -y
apt install -y wget curl lsof unzip
apt install -y python3-pip
+3 -5
View File
@@ -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
+3
View File
@@ -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
+60
View File
@@ -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
View File
@@ -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
+1 -1
View File
@@ -250,7 +250,7 @@ def systemTask():
cpuInfo = tmp
# 取当前网络Io
networkIo = psutil.net_io_counters()[:4]
networkIo = sm.psutilNetIoCounters()
if not network_up:
network_up = networkIo[0]
network_down = networkIo[1]