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

12 months 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/"
12 months ago
#获取用户传递的参数
arg1=$1
if [ "${BRANCH}" = "" ]
then
BRANCH="master"
fi
#启动脚本
function start(){
#运行nginx
12 months ago
$nginx -g "daemon off;"
12 months ago
#sleep 10
#tail -f /data/xcdn/logs/error.log
}
#停止脚本
function stop() {
#运行nginx
12 months ago
$nginx -s stop
12 months ago
}
#退出脚本
function quit() {
#运行nginx
12 months ago
$nginx -s quit
12 months ago
}
#重载配置
function reload(){
12 months ago
$nginx -t && $nginx -s reload
12 months ago
}
# 检查配置
function check_conf() {
12 months ago
$nginx -t
12 months ago
}
# 检查配置/SSL证书是否有更新,有更新则重载
function check_change() {
12 months ago
find ${CONF_PATH} -mmin -1 -exec /usr/sbin/xc.sh reload {} +
echo '-------------------------------------'
sleep 3
12 months ago
find ${SSL_PATH} -mmin -1 -exec /usr/sbin/xc.sh reload {} +
}
12 months ago
# 根据用户输入执行不同动作
case ${arg1} in
'start')
start
;;
'stop')
stop
;;
'quit')
quit
;;
'reload')
reload
;;
'-t')
check_conf
;;
'check_change')
check_change
;;
12 months ago
*)
echo 'Parameter error!'
;;
esac