diff --git a/ServerStatus1Click.sh b/ServerStatus1Click.sh index a9238af..c295c0f 100644 --- a/ServerStatus1Click.sh +++ b/ServerStatus1Click.sh @@ -3,26 +3,26 @@ #================================================= # System Required: CentOS 6+/Debian 6+/Ubuntu 14.04+/others(test) # Description: Auto-install the ServerStatus Client -# Version: 1.0.1 +# Version: 1.0.2 # Author: dovela #================================================= check_sys(){ - if [[ -f /etc/redhat-release ]]; then + if [[ -f /etc/redhat-release ]]; then release="centos" - elif cat /etc/issue | grep -q -E -i "debian"; then + elif cat /etc/issue | grep -q -E -i "debian"; then release="debian" - elif cat /etc/issue | grep -q -E -i "ubuntu"; then + elif cat /etc/issue | grep -q -E -i "ubuntu"; then 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" - elif cat /proc/version | grep -q -E -i "debian"; then + elif cat /proc/version | grep -q -E -i "debian"; then release="debian" - elif cat /proc/version | grep -q -E -i "ubuntu"; then + elif cat /proc/version | grep -q -E -i "ubuntu"; then 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" - fi + fi bit=`uname -m` } @@ -36,22 +36,26 @@ debian_apt(){ } install_sss(){ - clear + clear 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 " 客户端password:" spasswd - clear + clear git clone https://github.com/dovela/ServerStatus.git rm -rf oneclick.sh echo 'ServerStatus客户端安装完成' - cd ServerStatus/clients + cd ServerStatus/clients 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/spasswd/$spasswd/g" client-linux.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/spasswd/$spasswd/g" client-psutil.py - clear + clear echo ' ServerStatus客户端配置完成,请进行下一步' echo ' 1. 运行 client-linux' echo ' 2. 运行 client-psutil' @@ -68,13 +72,13 @@ esac run_linux(){ nohup python client-linux.py >> serverstatus.log 2>&1 & - cd ../.. + cd ../.. echo 'ServerStatus-linux客户端已开始运行' } run_psutil(){ nohup python client-psutil.py >> serverstatus.log 2>&1 & - cd ../.. + cd ../.. echo 'ServerStatus-psutil客户端已开始运行' } @@ -83,18 +87,18 @@ stop_client(){ } install_env(){ - clear - if [[ ${release} == "centos" ]]; then + clear + if [[ ${release} == "centos" ]]; then centos_yum - else + else debian_apt - fi + fi pip install --upgrade pip install psutil echo '依赖环境安装完成,请再次运行脚本' } -clear + clear check_sys [ $(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