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/zabbix/install.sh

79 lines
1.6 KiB

10 months ago
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
# https://www.zabbix.com
10 months ago
# cd /www/server/mdserver-web/plugins/zabbix && /bin/bash install.sh install 7.0
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/zabbix/index.py start
10 months ago
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
install_tmp=${rootPath}/tmp/mw_install.pl
VERSION=$2
sysName=`uname`
echo "use system: ${sysName}"
OSNAME=`bash ${rootPath}/scripts/getos.sh`
if [ "" == "$OSNAME" ];then
OSNAME=`cat ${rootPath}/data/osname.pl`
fi
if [ "macos" == "$OSNAME" ];then
echo "不支持Macox"
exit
fi
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
fi
10 months ago
Install_App()
10 months ago
{
echo '正在安装脚本文件...'
mkdir -p $serverPath/source/zabbix
10 months ago
shell_file=${curPath}/versions/${VERSION}/${OSNAME}.sh
10 months ago
if [ -f $shell_file ];then
10 months ago
bash -x $shell_file install
10 months ago
else
echo '不支持...'
exit 1
fi
if [ "$?" == "0" ];then
mkdir -p $serverPath/zabbix
echo "${VERSION}" > $serverPath/zabbix/version.pl
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/zabbix/index.py start
cd ${rootPath} && python3 ${rootPath}/plugins/zabbix/index.py initd_install
fi
echo 'Zabbix安装完成'
}
10 months ago
Uninstall_App()
10 months ago
{
10 months ago
cd ${rootPath} && python3 ${rootPath}/plugins/zabbix/index.py stop
cd ${rootPath} && python3 ${rootPath}/plugins/zabbix/index.py initd_uninstall
10 months ago
rm -rf $serverPath/zabbix
10 months ago
rm -rf $serverPath/source/zabbix
10 months ago
echo 'Zabbix卸载完成'
}
action=$1
if [ "${1}" == 'install' ];then
10 months ago
Install_App
10 months ago
else
10 months ago
Uninstall_App
10 months ago
fi