Docker + nginx + MySQL + PHP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
1.4 KiB

1 year ago
#!/bin/sh
############### XCDN管理脚本 ###############
# Author:xiaoz.me
# Update:2021-11-17
# Github:https://github.com/helloxz/xcdn
####################### END #######################
#nginx路径
NGINX_PATH="/usr/local/nginx"
nginx="${NGINX_PATH}/sbin/nginx"
# 配置文件路径
CONF_PATH="${NGINX_PATH}/conf/"
# SSL证书路径
SSL_PATH="${CONF_PATH}/ssl/"
1 year ago
#获取用户传递的参数
arg1=$1
if [ "${BRANCH}" = "" ]
then
BRANCH="master"
fi
#启动脚本
function start(){
#运行nginx
1 year ago
$nginx -g "daemon off;"
1 year ago
#sleep 10
#tail -f /data/xcdn/logs/error.log
}
#停止脚本
function stop() {
#运行nginx
1 year ago
$nginx -s stop
1 year ago
}
#退出脚本
function quit() {
#运行nginx
1 year ago
$nginx -s quit
1 year ago
}
#重载配置
function reload(){
1 year ago
$nginx -t && $nginx -s reload
1 year ago
}
# 检查配置
function check_conf() {
1 year ago
$nginx -t
1 year ago
}
# 检查配置/SSL证书是否有更新,有更新则重载
function check_change() {
1 year ago
find ${CONF_PATH} -mmin -1 -exec /usr/sbin/xc.sh reload {} +
echo '-------------------------------------'
sleep 3
1 year ago
find ${SSL_PATH} -mmin -1 -exec /usr/sbin/xc.sh reload {} +
}
1 year ago
# 根据用户输入执行不同动作
case ${arg1} in
'start')
start
;;
'stop')
stop
;;
'quit')
quit
;;
'reload')
reload
;;
'-t')
check_conf
;;
'check_change')
check_change
;;
1 year ago
*)
echo 'Parameter error!'
;;
esac