|
|
|
@ -20,46 +20,31 @@ fi
@@ -20,46 +20,31 @@ fi
|
|
|
|
|
#启动脚本 |
|
|
|
|
function start(){ |
|
|
|
|
#运行nginx |
|
|
|
|
$nginx -g "daemon off;" -c /data/xcdn/conf/nginx.conf |
|
|
|
|
$nginx -g "daemon off;" |
|
|
|
|
#sleep 10 |
|
|
|
|
#tail -f /data/xcdn/logs/error.log |
|
|
|
|
} |
|
|
|
|
#停止脚本 |
|
|
|
|
function stop() { |
|
|
|
|
#运行nginx |
|
|
|
|
$nginx -c /data/xcdn/conf/nginx.conf -s stop |
|
|
|
|
$nginx -s stop |
|
|
|
|
} |
|
|
|
|
#退出脚本 |
|
|
|
|
function quit() { |
|
|
|
|
#运行nginx |
|
|
|
|
$nginx -c /data/xcdn/conf/nginx.conf -s quit |
|
|
|
|
$nginx -s quit |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#重载配置 |
|
|
|
|
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() { |
|
|
|
|
$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 |
|
|
|
@ -78,9 +63,6 @@ case ${arg1} in
@@ -78,9 +63,6 @@ case ${arg1} in
|
|
|
|
|
'-t') |
|
|
|
|
check_conf |
|
|
|
|
;; |
|
|
|
|
'update') |
|
|
|
|
update |
|
|
|
|
;; |
|
|
|
|
*) |
|
|
|
|
echo 'Parameter error!' |
|
|
|
|
;; |
|
|
|
|