Merge pull request #235 from midoks/dev

添加卸载脚本
pull/242/head
Mr Chen 3 years ago committed by GitHub
commit a86588ee01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      README.md
  2. 5
      plugins/openresty/install.sh
  3. 2
      plugins/phpmyadmin/conf/config.inc.php
  4. 8
      plugins/phpmyadmin/index.py
  5. 16
      plugins/rsyncd/index.py
  6. 16
      plugins/rsyncd/install.sh
  7. 14
      plugins/rsyncd/js/rsyncd.js
  8. 1
      requirements.txt
  9. 1
      route/__init__.py
  10. 2
      scripts/init.d/mw.tpl
  11. 7
      scripts/install/debian.sh
  12. 7
      scripts/lib.sh
  13. 142
      scripts/uninstall.sh

@ -137,7 +137,7 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts
- 卸载脚本
```
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/uninstall.sh | bash
wget -O uninstall.sh https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/uninstall.sh && bash uninstall.sh
```
@ -156,6 +156,7 @@ 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
wget -O uninstall.sh https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/uninstall.sh && bash uninstall.sh
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

@ -16,11 +16,10 @@ install_tmp=${rootPath}/tmp/mw_install.pl
openrestyDir=${serverPath}/source/openresty
if id www &> /dev/null ;then
echo "www UID is `id -u www`"
echo "www Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
echo "www uid is `id -u www`"
echo "www shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
else
groupadd www
# useradd -g www -s /sbin/nologin www
useradd -g www -s /bin/bash www
fi

@ -10,7 +10,7 @@ $cfg['Servers'][$i]['socket'] = '{$SERVER_PATH}/{$CHOOSE_DB_DIR}/mysql.
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['TempDir'] = '{$SERVER_PATH}/phpmyadmin/tmp';
$cfg['TempDir'] = '{$SERVER_PATH}/phpmyadmin/{$PMA_PATH}/tmp';
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>

@ -85,10 +85,16 @@ def getPhpVer(expect=55):
import json
v = site_api.site_api().getPhpVersion()
v = json.loads(v)
is_find = False
for i in range(len(v)):
t = int(v[i]['version'])
if (t >= expect):
if (t == expect):
is_find = True
return str(t)
if not is_find:
if len(v) > 1:
return v[1]['version']
return v[0]['version']
return str(expect)

@ -363,6 +363,10 @@ def addRec():
args_path = args['path']
args_ps = args['ps']
if not mw.isAppleSystem():
mw.execShell("mkdir -p " + args_path)
mw.execShell("chown -R www:www " + args_path)
delRecBy(args_name)
auth_path = appAuthPwd(args_name)
@ -506,9 +510,13 @@ def cmdRecCmd():
# ----------------------------- rsyncdSend start -------------------------
def lsyncdReload():
mw.execShell('systemctl reload lsyncd')
data = mw.execShell(
"ps -ef|grep lsyncd |grep -v grep | grep -v python | awk '{print $2}'")
if data[0] == '':
mw.execShell('systemctl start lsyncd')
else:
mw.execShell('systemctl restart lsyncd')
def makeLsyncdConf(data):
@ -692,6 +700,10 @@ def lsyncdAdd():
ip = args['ip']
path = args['path']
if not mw.isAppleSystem():
mw.execShell("mkdir -p " + path)
mw.execShell("chown -R www:www " + path)
conn_type = args['conn_type']
secret_key = args['secret_key']
delete = args['delete']

@ -16,6 +16,14 @@ bash ${rootPath}/scripts/getos.sh
OSNAME=`cat ${rootPath}/data/osname.pl`
if id www &> /dev/null ;then
echo "www uid is `id -u www`"
echo "www shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
else
groupadd www
useradd -g www -s /bin/bash www
fi
echo $OSNAME
install_tmp=${rootPath}/tmp/mw_install.pl
Install_rsyncd()
@ -58,6 +66,14 @@ Uninstall_rsyncd()
systemctl daemon-reload
fi
if [ -f /usr/lib/systemd/system/lsyncd.service ] || [ -f /lib/systemd/system/lsyncd.service ];then
systemctl stop lsyncd
systemctl disable lsyncd
rm -rf /usr/lib/systemd/system/lsyncd.service
rm -rf /lib/systemd/system/lsyncd.service
systemctl daemon-reload
fi
if [ -f $serverPath/rsyncd/initd/rsyncd ];then
$serverPath/rsyncd/initd/rsyncd stop
fi

@ -1,18 +1,8 @@
function str2Obj(str){
var data = {};
kv = str.split('&');
for(i in kv){
v = kv[i].split('=');
data[v[0]] = v[1];
}
return data;
}
function rsPost(method,args,callback, title){
var _args = null;
if (typeof(args) == 'string'){
_args = JSON.stringify(str2Obj(args));
_args = JSON.stringify(toArrayObject(args));
} else {
_args = JSON.stringify(args);
}
@ -537,7 +527,7 @@ function lsyncdSend(){
con += '<tr>'+
'<td>' + list[i]['name']+'</td>' +
'<td><a class="btlink overflow_hide" style="width:40px;" onclick="openPath(\''+list[i]['path']+'\')">' + list[i]['path']+'</a></td>' +
'<td>' + list[i]['ip']+":"+"cc"+'</td>' +
'<td>' + list[i]['ip']+":"+list[i]['name']+'</td>' +
'<td>' + mode+'</td>' +
'<td>' + period +'</td>' +
'<td>\

@ -24,5 +24,6 @@ pymongo
pillow
Jinja2>=2.11.2
flask-caching>=1.10.1
bcrypt==3.1.3
PyMySQL
mysql-connector-python

@ -208,6 +208,7 @@ def doLogin():
login_cache_limit = cache.get('login_cache_limit')
code_msg = mw.getInfo("验证码错误,您还可以尝试[{1}]次!", (str(
login_cache_count - login_cache_limit)))
mw.writeLog('用户登录', code_msg)
return mw.returnJson(False, code_msg)
userInfo = mw.M('users').where(

@ -14,7 +14,7 @@
PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
# export LC_ALL="en_US.UTF-8"
export LC_ALL=en_US.UTF-8
mw_path={$SERVER_PATH}
PATH=$PATH:$mw_path/bin

@ -16,6 +16,13 @@ if grep -Eq "Debian" /etc/*-release; then
ln -sf /bin/bash /bin/sh
fi
__GET_BIT=`getconf LONG_BIT`
if [ "$__GET_BIT" == "32" ];then
# install rust | 32bit need
# curl https://sh.rustup.rs -sSf | sh
apt install -y rustc
fi
# synchronize time first
apt-get install ntpdate -y
ntpdate time.nist.gov | logger -t NTP

@ -102,7 +102,6 @@ fi
#面板需要的库
if [ ! -f /usr/local/bin/pip3 ];then
# python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
python3 -m pip install --upgrade pip setuptools wheel -i https://pypi.python.org/pypi
@ -112,8 +111,7 @@ pip install --upgrade pip
pip3 install --upgrade setuptools
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
pip3 install gevent-websocket==0.10.1
pip3 install flask-caching==1.10.1
# pip3 install flask-caching==1.10.1
# pip3 install mysqlclient
@ -128,7 +126,6 @@ pip install --upgrade pip
pip3 install --upgrade setuptools
pip3 install -r /www/server/mdserver-web/requirements.txt
pip3 install gevent-websocket==0.10.1
pip3 install flask-caching==1.10.1
# pip3 install flask-caching==1.10.1
# pip3 install mysqlclient

@ -1,7 +1,7 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# LANG=en_US.UTF-8
export LANG=en_US.UTF-8
is64bit=`getconf LONG_BIT`
if [ -f /etc/motd ];then
@ -18,14 +18,144 @@ if [ "$EUID" -ne 0 ]
exit
fi
UNINSTALL_CHECK()
{
echo -e "----------------------------------------------------"
echo -e "暂时只能卸载OpenResty/PHP/MySQL/Redis/Memcached"
echo -e "其他插件先手动卸载!"
echo -e "----------------------------------------------------"
echo -e "已知风险/输入yes强制卸载![yes/no]"
read -p "输入yes强制卸载: " yes;
if [ "$yes" != "yes" ];then
echo -e "------------"
echo "取消卸载"
exit 1
else
echo "开始卸载!"
fi
}
rm -rf /usr/bin/mw
rm -rf /www
UNINSTALL_MySQL()
{
MYSQLD_CHECK=$(ps -ef |grep mysqld | grep -v grep | grep /www/server/mysql)
if [ "$MYSQLD_CHECK" != "" ];then
echo -e "----------------------------------------------------"
echo -e "检查已有MySQL环境,卸载可能影响现有站点及数据"
echo -e "----------------------------------------------------"
echo -e "已知风险/输入yes强制卸载![yes/no]"
read -p "输入yes强制卸载: " yes;
if [ "$yes" != "yes" ];then
echo -e "------------"
echo "取消卸载MySQL"
else
cd /www/server/mdserver-web/plugins/mysql && sh install.sh uninstall 8.0
echo "卸载MySQL成功!"
fi
fi
}
UNINSTALL_OP()
{
if [ -f /www/server/openresty ];then
echo -e "----------------------------------------------------"
echo -e "检查已有OpenResty环境,卸载可能影响现有站点及数据"
echo -e "----------------------------------------------------"
echo -e "已知风险/输入yes强制卸载![yes/no]"
read -p "输入yes强制卸载: " yes;
if [ "$yes" != "yes" ];then
echo -e "------------"
echo "取消卸载OpenResty"
else
cd /www/server/mdserver-web/plugins/openresty && sh install.sh uninstall
echo "卸载OpenResty成功!"
fi
fi
}
UNINSTALL_PHP()
{
if [ -d /www/server/php ];then
echo -e "----------------------------------------------------"
echo -e "检查已有PHP环境,卸载可能影响现有站点及数据"
echo -e "----------------------------------------------------"
read -p "输入yes强制卸载所有PHP[yes/no]: " yes;
if [ "$yes" != "yes" ];then
echo -e "------------"
echo "取消卸载PHP"
else
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81 82)
for PHP_VER in ${PHP_VER_LIST[@]}; do
if [ -d /www/server/php/${PHP_VER} ];then
cd /www/server/mdserver-web/plugins/php && bash install.sh uninstall ${PHP_VER}
fi
echo "卸载PHP${PHP_VER}成功!"
done
fi
fi
}
UNINSTALL_MEMCACHED()
{
if [ -d /www/server/memcached ];then
echo -e "----------------------------------------------------"
echo -e "检查已有Memcached环境,卸载可能影响现有站点及数据"
echo -e "----------------------------------------------------"
read -p "输入yes强制卸载所有Memcached[yes/no]: " yes;
if [ "$yes" != "yes" ];then
echo -e "------------"
echo "取消卸载Memcached"
else
cd /www/server/mdserver-web/plugins/memcached && bash install.sh uninstall
echo "卸载Memcached成功"
fi
fi
}
UNINSTALL_REDIS()
{
if [ -d /www/server/redis ];then
echo -e "----------------------------------------------------"
echo -e "检查已有Redis环境,卸载可能影响现有站点及数据"
echo -e "----------------------------------------------------"
read -p "输入yes强制卸载所有Redis[yes/no]: " yes;
if [ "$yes" != "yes" ];then
echo -e "------------"
echo "取消卸载Redis"
else
cd /www/server/mdserver-web/plugins/redis && bash install.sh uninstall 7.0.4
echo "卸载Redis成功"
fi
fi
}
UNINSTALL_MW()
{
echo -e "----------------------------------------------------"
echo -e "检查已有mderver-web环境,卸载可能影响现有站点及数据"
echo -e "----------------------------------------------------"
read -p "输入yes强制卸载面板: " yes;
if [ "$yes" != "yes" ];then
echo -e "------------"
echo "取消卸载面板"
else
rm -rf /usr/bin/mw
rm -rf /etc/init.d/mw
systemctl daemon-reload
rm -rf /www/server/mdserver-web
echo "卸载面板成功"
fi
}
UNINSTALL_CHECK
UNINSTALL_OP
UNINSTALL_PHP
UNINSTALL_MySQL
UNINSTALL_MEMCACHED
UNINSTALL_REDIS
UNINSTALL_MW
endTime=`date +%s`
((outTime=(${endTime}-${startTime})/60))
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
systemctl daemon-reload

Loading…
Cancel
Save