mdserver-web/plugins/system_safe/install.sh

49 lines
1.2 KiB
Bash
Raw Permalink Normal View History

2023-04-13 02:39:18 -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")
SYSOS=`uname`
VERSION=$2
APP_NAME=system_safe
2024-12-27 04:40:13 -05:00
# cd /www/server/mdserver-web && python3 plugins/system_safe/system_safe.py stop 1.0
2023-04-13 02:39:18 -04:00
Install_App()
{
2024-11-30 08:44:09 -05:00
echo '正在安装脚本文件...'
2023-04-13 02:39:18 -04:00
mkdir -p $serverPath/system_safe
echo "$VERSION" > $serverPath/system_safe/version.pl
2024-11-30 08:44:09 -05:00
echo 'install complete'
2023-04-13 02:39:18 -04:00
#初始化
2023-04-13 02:42:07 -04:00
cd ${serverPath}/mdserver-web && python3 plugins/system_safe/system_safe.py start $VERSION
cd ${serverPath}/mdserver-web && python3 plugins/system_safe/system_safe.py initd_install $VERSION
2023-04-13 02:39:18 -04:00
}
Uninstall_App()
{
if [ -f /usr/lib/systemd/system/${APP_NAME}.service ] || [ -f /lib/systemd/system/${APP_NAME}.service ] ;then
systemctl stop ${APP_NAME}
systemctl disable ${APP_NAME}
rm -rf /usr/lib/systemd/system/${APP_NAME}.service
rm -rf /lib/systemd/system/${APP_NAME}.service
systemctl daemon-reload
fi
rm -rf $serverPath/system_safe
2024-11-30 08:44:09 -05:00
echo "uninstall completed"
2023-04-13 02:39:18 -04:00
}
action=$1
if [ "${1}" == 'install' ];then
Install_App
else
Uninstall_App
fi