mirror of https://github.com/cppla/ServerStatus
加入自定义端口选项
parent
c292ef075d
commit
b4429203a4
|
@ -3,26 +3,26 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
# System Required: CentOS 6+/Debian 6+/Ubuntu 14.04+/others(test)
|
# System Required: CentOS 6+/Debian 6+/Ubuntu 14.04+/others(test)
|
||||||
# Description: Auto-install the ServerStatus Client
|
# Description: Auto-install the ServerStatus Client
|
||||||
# Version: 1.0.1
|
# Version: 1.0.2
|
||||||
# Author: dovela
|
# Author: dovela
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
check_sys(){
|
check_sys(){
|
||||||
if [[ -f /etc/redhat-release ]]; then
|
if [[ -f /etc/redhat-release ]]; then
|
||||||
release="centos"
|
release="centos"
|
||||||
elif cat /etc/issue | grep -q -E -i "debian"; then
|
elif cat /etc/issue | grep -q -E -i "debian"; then
|
||||||
release="debian"
|
release="debian"
|
||||||
elif cat /etc/issue | grep -q -E -i "ubuntu"; then
|
elif cat /etc/issue | grep -q -E -i "ubuntu"; then
|
||||||
release="ubuntu"
|
release="ubuntu"
|
||||||
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
|
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
|
||||||
release="centos"
|
release="centos"
|
||||||
elif cat /proc/version | grep -q -E -i "debian"; then
|
elif cat /proc/version | grep -q -E -i "debian"; then
|
||||||
release="debian"
|
release="debian"
|
||||||
elif cat /proc/version | grep -q -E -i "ubuntu"; then
|
elif cat /proc/version | grep -q -E -i "ubuntu"; then
|
||||||
release="ubuntu"
|
release="ubuntu"
|
||||||
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
|
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
|
||||||
release="centos"
|
release="centos"
|
||||||
fi
|
fi
|
||||||
bit=`uname -m`
|
bit=`uname -m`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,22 +36,26 @@ debian_apt(){
|
||||||
}
|
}
|
||||||
|
|
||||||
install_sss(){
|
install_sss(){
|
||||||
clear
|
clear
|
||||||
stty erase '^H' && read -p " 服务端地址:" sserver
|
stty erase '^H' && read -p " 服务端地址:" sserver
|
||||||
|
stty erase '^H' && read -p " 远程端口(默认35601):" sport
|
||||||
|
[[ -z ${sport} ]] && sport="35601"
|
||||||
stty erase '^H' && read -p " 客户端username:" suser
|
stty erase '^H' && read -p " 客户端username:" suser
|
||||||
stty erase '^H' && read -p " 客户端password:" spasswd
|
stty erase '^H' && read -p " 客户端password:" spasswd
|
||||||
clear
|
clear
|
||||||
git clone https://github.com/dovela/ServerStatus.git
|
git clone https://github.com/dovela/ServerStatus.git
|
||||||
rm -rf oneclick.sh
|
rm -rf oneclick.sh
|
||||||
echo 'ServerStatus客户端安装完成'
|
echo 'ServerStatus客户端安装完成'
|
||||||
cd ServerStatus/clients
|
cd ServerStatus/clients
|
||||||
sed -i -e "s/sserver/$sserver/g" client-linux.py
|
sed -i -e "s/sserver/$sserver/g" client-linux.py
|
||||||
|
sed -i -e "s/sport/$sport/g" client-linux.py
|
||||||
sed -i -e "s/suser/$suser/g" client-linux.py
|
sed -i -e "s/suser/$suser/g" client-linux.py
|
||||||
sed -i -e "s/spasswd/$spasswd/g" client-linux.py
|
sed -i -e "s/spasswd/$spasswd/g" client-linux.py
|
||||||
sed -i -e "s/sserver/$sserver/g" client-psutil.py
|
sed -i -e "s/sserver/$sserver/g" client-psutil.py
|
||||||
|
sed -i -e "s/sport/$sport/g" client-psutil.py
|
||||||
sed -i -e "s/suser/$suser/g" client-psutil.py
|
sed -i -e "s/suser/$suser/g" client-psutil.py
|
||||||
sed -i -e "s/spasswd/$spasswd/g" client-psutil.py
|
sed -i -e "s/spasswd/$spasswd/g" client-psutil.py
|
||||||
clear
|
clear
|
||||||
echo ' ServerStatus客户端配置完成,请进行下一步'
|
echo ' ServerStatus客户端配置完成,请进行下一步'
|
||||||
echo ' 1. 运行 client-linux'
|
echo ' 1. 运行 client-linux'
|
||||||
echo ' 2. 运行 client-psutil'
|
echo ' 2. 运行 client-psutil'
|
||||||
|
@ -68,13 +72,13 @@ esac
|
||||||
|
|
||||||
run_linux(){
|
run_linux(){
|
||||||
nohup python client-linux.py >> serverstatus.log 2>&1 &
|
nohup python client-linux.py >> serverstatus.log 2>&1 &
|
||||||
cd ../..
|
cd ../..
|
||||||
echo 'ServerStatus-linux客户端已开始运行'
|
echo 'ServerStatus-linux客户端已开始运行'
|
||||||
}
|
}
|
||||||
|
|
||||||
run_psutil(){
|
run_psutil(){
|
||||||
nohup python client-psutil.py >> serverstatus.log 2>&1 &
|
nohup python client-psutil.py >> serverstatus.log 2>&1 &
|
||||||
cd ../..
|
cd ../..
|
||||||
echo 'ServerStatus-psutil客户端已开始运行'
|
echo 'ServerStatus-psutil客户端已开始运行'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,18 +87,18 @@ stop_client(){
|
||||||
}
|
}
|
||||||
|
|
||||||
install_env(){
|
install_env(){
|
||||||
clear
|
clear
|
||||||
if [[ ${release} == "centos" ]]; then
|
if [[ ${release} == "centos" ]]; then
|
||||||
centos_yum
|
centos_yum
|
||||||
else
|
else
|
||||||
debian_apt
|
debian_apt
|
||||||
fi
|
fi
|
||||||
pip install --upgrade
|
pip install --upgrade
|
||||||
pip install psutil
|
pip install psutil
|
||||||
echo '依赖环境安装完成,请再次运行脚本'
|
echo '依赖环境安装完成,请再次运行脚本'
|
||||||
}
|
}
|
||||||
|
|
||||||
clear
|
clear
|
||||||
check_sys
|
check_sys
|
||||||
[ $(id -u) != "0" ] && echo -e "Error: You must be root to run this script" && exit 1
|
[ $(id -u) != "0" ] && echo -e "Error: You must be root to run this script" && exit 1
|
||||||
echo -e " 默认端口35601,出现问题请在 https://github.com/dovela/ServerStatus1Click 处提issue
|
echo -e " 默认端口35601,出现问题请在 https://github.com/dovela/ServerStatus1Click 处提issue
|
||||||
|
|
Loading…
Reference in New Issue