mdserver-web/plugins/openresty/install.sh

89 lines
2.5 KiB
Bash
Raw Permalink Normal View History

2018-11-25 04:48:48 -05:00
#!/bin/bash
2023-11-08 02:28:52 -05:00
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
2018-11-25 04:48:48 -05:00
export PATH
2026-04-22 12:12:59 -04:00
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/openresty && bash install.sh upgrade 1.29.2
2024-11-30 12:40:56 -05:00
# cd /www/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4
2026-03-31 10:50:08 -04:00
# cd /www/server/mdserver-web/plugins/openresty && bash install.sh install 1.29.2
2026-04-02 14:57:18 -04:00
# cd /www/server/mdserver-web/plugins/openresty && bash install.sh upgrade 1.29.2
2023-02-13 07:34:25 -05:00
2026-03-31 12:13:38 -04:00
# curl -I -H "Accept-Encoding: br" http://localhost
2026-04-04 01:31:44 -04:00
# curl -I -H "Accept-Encoding: zstd" http://localhost
2026-04-01 23:02:47 -04:00
# curl --http3 -v https://www.xxx.com
2026-03-31 12:13:38 -04:00
2026-04-05 02:44:22 -04:00
# apt install ncat -y
2026-04-11 01:02:33 -04:00
# nc -u -v www.xx.com 443
2026-04-05 02:44:22 -04:00
2026-05-20 22:32:07 -04:00
# /www/server/openresty/bin/openresty -v
2026-05-20 23:08:06 -04:00
# service openresty restart
2026-05-20 22:32:07 -04:00
2025-04-15 11:49:42 -04:00
# cd /www/server/mdserver-web && python3 plugins/openresty/index.py run_info
2018-11-25 04:48:48 -05:00
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
2023-11-08 12:32:59 -05:00
sysName=`uname`
2018-12-04 22:01:25 -05:00
action=$1
type=$2
2018-11-25 04:48:48 -05:00
2020-06-28 01:44:38 -04:00
VERSION=$2
openrestyDir=${serverPath}/source/openresty
2019-02-02 09:13:51 -05:00
if id www &> /dev/null ;then
2022-11-01 08:27:20 -04:00
echo "www uid is `id -u www`"
echo "www shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
2019-02-02 09:13:51 -05:00
else
groupadd www
2020-09-28 00:52:11 -04:00
useradd -g www -s /bin/bash www
2019-02-02 09:13:51 -05:00
fi
2026-04-02 14:55:55 -04:00
if [ "${action}" == "upgrade" ];then
2026-04-02 15:12:58 -04:00
sh -x $curPath/versions/$2/install.sh $1
2026-04-02 14:55:55 -04:00
echo "${VERSION}" > $serverPath/openresty/version.pl
mkdir -p $serverPath/web_conf/php/conf
echo 'set $PHP_ENV 0;' > $serverPath/web_conf/php/conf/enable-php-00.conf
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py start
cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py initd_install
2026-04-02 15:12:58 -04:00
exit 0
2026-04-02 14:55:55 -04:00
fi
2024-07-23 00:43:11 -04:00
if [ "${2}" == "" ];then
echo '缺少安装脚本版本...'
exit 0
fi
if [ "${action}" == "uninstall" ];then
2022-07-11 03:19:39 -04:00
if [ -f /usr/lib/systemd/system/openresty.service ] || [ -f /lib/systemd/system/openresty.service ];then
2022-06-28 13:07:25 -04:00
systemctl stop openresty
2022-07-03 10:08:21 -04:00
rm -rf /usr/systemd/system/openresty.service
2022-07-11 03:19:39 -04:00
rm -rf /lib/systemd/system/openresty.service
2022-06-28 13:31:34 -04:00
systemctl daemon-reload
fi
if [ -f $serverPath/openresty/init.d/openresty ];then
$serverPath/openresty/init.d/openresty stop
2022-06-18 03:44:17 -04:00
fi
2022-06-28 13:07:25 -04:00
rm -rf $serverPath/openresty
2024-07-23 00:43:11 -04:00
fi
2020-06-28 01:44:38 -04:00
2024-07-23 00:43:11 -04:00
sh -x $curPath/versions/$2/install.sh $1
2024-07-24 00:57:12 -04:00
if [ "${action}" == "install" ] && [ -d $serverPath/openresty ];then
2024-07-23 00:43:11 -04:00
echo "${VERSION}" > $serverPath/openresty/version.pl
mkdir -p $serverPath/web_conf/php/conf
echo 'set $PHP_ENV 0;' > $serverPath/web_conf/php/conf/enable-php-00.conf
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py start
cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py initd_install
2020-06-28 01:44:38 -04:00
fi