mdserver-web/plugins/mysql/install.sh

49 lines
1.1 KiB
Bash
Raw Normal View History

2018-10-07 08:38:30 -04:00
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
2018-12-09 21:44:54 -05:00
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
2019-03-12 04:28:48 -04:00
install_tmp=${rootPath}/tmp/mw_install.pl
2018-10-07 08:38:30 -04:00
action=$1
2018-12-09 21:44:54 -05:00
type=$2
if [ "${2}" == "" ];then
echo '缺少安装脚本...' > $install_tmp
exit 0
fi
if [ ! -d $curPath/versions/$2 ];then
echo '缺少安装脚本2...' > $install_tmp
exit 0
2018-10-07 08:38:30 -04:00
fi
2018-12-09 21:44:54 -05:00
2022-11-18 11:46:08 -05:00
if [ -d $serverPath/mysql ];then
exit 0
fi
if [ "${action}" == "uninstall" ];then
2022-07-11 11:23:55 -04:00
if [ -f /usr/lib/systemd/system/mysql.service ] || [ -f /lib/systemd/system/mysql.service ];then
systemctl stop mysql
systemctl disable mysql
2022-07-03 10:22:03 -04:00
rm -rf /usr/lib/systemd/system/mysql.service
2022-07-11 11:23:55 -04:00
rm -rf /lib/systemd/system/mysql.service
systemctl daemon-reload
fi
fi
2018-12-09 21:44:54 -05:00
sh -x $curPath/versions/$2/install.sh $1
if [ "${action}" == "install" ] && [ -d $serverPath/mysql ];then
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/mysql/index.py start ${type}
2022-06-29 05:07:45 -04:00
cd ${rootPath} && python3 ${rootPath}/plugins/mysql/index.py initd_install ${type}
fi