mdserver-web/plugins/xhprof/install.sh

48 lines
969 B
Bash
Raw Permalink Normal View History

2020-07-12 06:14:56 -04:00
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
2022-07-27 01:54:59 -04:00
sys_os=`uname`
2020-07-12 06:14:56 -04:00
Install_xh()
{
mkdir -p ${serverPath}/xhprof
if [ ! -d ${serverPath}/xhprof/xhprof_lib ];then
2020-07-12 06:37:13 -04:00
cp -rf $curPath/lib/* ${serverPath}/xhprof
2020-07-12 06:14:56 -04:00
fi
echo "${1}" > ${serverPath}/xhprof/version.pl
2024-11-30 08:44:09 -05:00
echo '安装完成'
2022-07-27 01:54:59 -04:00
if [ "$sys_os" != "Darwin" ];then
cd $rootPath && python3 ${rootPath}/plugins/xhprof/index.py start
fi
2020-07-12 06:14:56 -04:00
}
Uninstall_xh()
{
2022-07-27 01:54:59 -04:00
if [ "$sys_os" != "Darwin" ];then
cd $rootPath && python3 ${rootPath}/plugins/xhprof/index.py stop
fi
2020-07-12 06:14:56 -04:00
rm -rf ${serverPath}/xhprof
2020-07-12 12:14:56 -04:00
cd /tmp/xhprof && rm -rf *.xhprof
2022-07-27 02:01:53 -04:00
if [ -f ${serverPath}/web_conf/nginx/vhost/xhprof.conf ];then
rm -f ${serverPath}/web_conf/nginx/vhost/xhprof.conf
fi
2024-11-30 08:44:09 -05:00
echo '卸载完成'
2020-07-12 06:14:56 -04:00
}
action=$1
if [ "${1}" == 'install' ];then
Install_xh $2
else
Uninstall_xh $2
fi