|
|
@ -20,46 +20,31 @@ fi |
|
|
|
#启动脚本 |
|
|
|
#启动脚本 |
|
|
|
function start(){ |
|
|
|
function start(){ |
|
|
|
#运行nginx |
|
|
|
#运行nginx |
|
|
|
$nginx -g "daemon off;" -c /data/xcdn/conf/nginx.conf |
|
|
|
$nginx -g "daemon off;" |
|
|
|
#sleep 10 |
|
|
|
#sleep 10 |
|
|
|
#tail -f /data/xcdn/logs/error.log |
|
|
|
#tail -f /data/xcdn/logs/error.log |
|
|
|
} |
|
|
|
} |
|
|
|
#停止脚本 |
|
|
|
#停止脚本 |
|
|
|
function stop() { |
|
|
|
function stop() { |
|
|
|
#运行nginx |
|
|
|
#运行nginx |
|
|
|
$nginx -c /data/xcdn/conf/nginx.conf -s stop |
|
|
|
$nginx -s stop |
|
|
|
} |
|
|
|
} |
|
|
|
#退出脚本 |
|
|
|
#退出脚本 |
|
|
|
function quit() { |
|
|
|
function quit() { |
|
|
|
#运行nginx |
|
|
|
#运行nginx |
|
|
|
$nginx -c /data/xcdn/conf/nginx.conf -s quit |
|
|
|
$nginx -s quit |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#重载配置 |
|
|
|
#重载配置 |
|
|
|
function reload(){ |
|
|
|
function reload(){ |
|
|
|
$nginx -c /data/xcdn/conf/nginx.conf -t && $nginx -c /data/xcdn/conf/nginx.conf -s reload |
|
|
|
$nginx -t && $nginx -s reload |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# 检查配置 |
|
|
|
# 检查配置 |
|
|
|
function check_conf() { |
|
|
|
function check_conf() { |
|
|
|
$nginx -c /data/xcdn/conf/nginx.conf -t |
|
|
|
$nginx -t |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#强制更新配置 |
|
|
|
|
|
|
|
function update(){ |
|
|
|
|
|
|
|
cd /data/xcdn |
|
|
|
|
|
|
|
git pull origin ${BRANCH} |
|
|
|
|
|
|
|
reload |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#push代码 |
|
|
|
|
|
|
|
function push(){ |
|
|
|
|
|
|
|
cd /data/xcdn |
|
|
|
|
|
|
|
git add /data/xcdn/conf/* |
|
|
|
|
|
|
|
git add /data/xcdn/ssl/* |
|
|
|
|
|
|
|
git commit -m "$(date +%Y-%m-%d/%H:%m)" |
|
|
|
|
|
|
|
git push origin ${BRANCH} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 根据用户输入执行不同动作 |
|
|
|
# 根据用户输入执行不同动作 |
|
|
|
case ${arg1} in |
|
|
|
case ${arg1} in |
|
|
@ -78,9 +63,6 @@ case ${arg1} in |
|
|
|
'-t') |
|
|
|
'-t') |
|
|
|
check_conf |
|
|
|
check_conf |
|
|
|
;; |
|
|
|
;; |
|
|
|
'update') |
|
|
|
|
|
|
|
update |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
*) |
|
|
|
*) |
|
|
|
echo 'Parameter error!' |
|
|
|
echo 'Parameter error!' |
|
|
|
;; |
|
|
|
;; |
|
|
|