Simple Linux Panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mdserver-web/plugins/lvs/install.sh

84 lines
1.6 KiB

#!/bin/bash
2 years ago
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH=$PATH:/opt/homebrew/bin
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
2 years ago
install_tmp=${rootPath}/tmp/mw_install.pl
2 years ago
sys_os=`uname`
VERSION=1.6.22
2 years ago
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/lvs && bash install.sh install 1.0
# cd /www/server/mdserver-web/plugins/lvs && bash install.sh install 1.0
2 years ago
Install_LVS(){
mkdir -p $serverPath/source
which ipvsadm
if [ "$?" == "0" ];then
echo '已安装LVS!!'
exit 0
fi
2 years ago
echo '正在安装LVS...'
2 years ago
# 检测平台命令
which apt
if [ "$?" == "0" ];then
apt install -y ipvsadm
fi
2 years ago
which yum
if [ "$?" == "0" ];then
yum install -y ipvsadm
fi
which ipvsadm
if [ "$?" == "0" ];then
2 years ago
echo '正在安装LVS成功!'
mkdir -p $serverPath/lvs
ipv_version=`ipvsadm -v | awk '{print $2}'`
if [ "$ipv_version" != "" ];then
echo "$ipv_version" > $serverPath/lvs/version.pl
else
echo '1.0' > $serverPath/lvs/version.pl
fi
2 years ago
cd ${rootPath} && python3 ${rootPath}/plugins/lvs/index.py start
cd ${rootPath} && python3 ${rootPath}/plugins/lvs/index.py initd_install
else
echo '正在安装LVS失败!'
fi
2 years ago
}
Uninstall_LVS()
{
# 检测平台命令
which apt
if [ "$?" == "0" ];then
apt remove -y ipvsadm
fi
which yum
if [ "$?" == "0" ];then
yum uninstall -y ipvsadm
fi
2 years ago
echo "卸载LVS完成"
if [ -d $serverPath/lvs ];then
rm -rf $serverPath/lvs
fi
2 years ago
}
action=$1
if [ "${1}" == 'install' ];then
Install_LVS
else
Uninstall_LVS
fi