mdserver-web/plugins/php/install.sh

55 lines
1.3 KiB
Bash
Raw Normal View History

2018-10-07 06:51:52 -04:00
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
2018-11-26 00:57:06 -05:00
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
2019-03-13 05:19:33 -04:00
install_tmp=${rootPath}/tmp/mw_install.pl
2018-11-26 00:57:06 -05:00
2022-06-10 05:53:23 -04:00
if id www &> /dev/null ;then
echo "www UID is `id -u www`"
echo "www Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
else
groupadd www
# useradd -g www -s /sbin/nologin www
useradd -g www -s /bin/bash www
fi
2018-10-07 06:51:52 -04:00
2018-11-27 00:17:06 -05:00
action=$1
type=$2
2018-10-07 06:51:52 -04:00
2018-11-27 00:17:06 -05:00
if [ "${2}" == "" ];then
echo '缺少安装脚本...' > $install_tmp
exit 0
fi
2018-10-07 06:51:52 -04:00
2018-11-27 00:17:06 -05:00
if [ ! -d $curPath/versions/$2 ];then
echo '缺少安装脚本2...' > $install_tmp
2018-11-27 01:37:24 -05:00
exit 0
2018-10-07 06:51:52 -04:00
fi
2018-11-27 00:17:06 -05:00
2022-06-28 13:13:33 -04:00
if [ "${action}" == "uninstall" ];then
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py stop ${type}
cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py initd_uninstall ${type}
2022-06-28 13:39:03 -04:00
if [ -f /lib/systemd/system/php${type}.service ];then
systemctl stop php${type}
rm -rf /lib/systemd/system/php${type}.service
systemctl daemon-reload
fi
2022-06-28 13:13:33 -04:00
fi
2022-06-28 13:57:06 -04:00
cd ${curPath} && sh -x $curPath/versions/$2/install.sh $1
2022-06-28 13:13:33 -04:00
2022-06-28 13:57:06 -04:00
if [ "${action}" == "install" ];then
2022-06-28 13:13:33 -04:00
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py start ${type}
cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py initd_install ${type}
fi