#!/bin/bashnginx
[ -f /etc/init.d/functions ] && . /etc/init.d/functions bash
pid=/application/nginx/logs/nginx.pidapp
nginx=/application/nginx/sbin/nginxide
RED_COLOR='\E[1;31m'rest
GREEN_COLOR='\E[1;32m'it
YELLOW_COLOR='\E[1;33m'io
BLUE_COLOR='\E[1;34m'function
PINK='\E[1;35m'class
SHAN='\E[31;5m'top
RES='\E[0m'
start(){
if [ -f $pid ]; then
action "nginx 正在運行的" /bin/false
else
$nginx
action "nginx 啓動" /bin/true
fi
}
stop(){
if [ ! -f $pid ]; then
action "nginx 已經中止了" /bin/false
else
$nginx -s stop
action "nginx 中止" /bin/true
fi
}
reload(){
if [ ! -f $pid ]; then
action "nginx 已經中止了" /bin/false
else
$nginx -s reload
action "nginx 已重啓" /bin/true
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
sleep 2
start
;;
*)
echo -e "${SHAN}腦殘這是例子 :$0 (stop|start|reload|restart)$RES"
esac