Shell腳本100例:10 編寫nginx啓動腳本

program=/usr/local/nginx/sbin/nginx

pid=/usr/local/nginx/logs/nginx.pid

start(){

if [ -f $pid ];then

echo "nginx running"

else

$program

fi

}

stop(){

if [ ! -f $pid ];then

echo "nginx stop"

else

$program -s stop

echo "nginx stop"

fi

}

reload(){

$program -s reload

echo "nginx reloading complete"

}

status(){

if [ -f $pid ];then

echo "nginx running"

else

echo "nginx stop"

fi

}

case $1 in

start)

start;;

stop)

stop;;

reload)

reload;;

status)

status;;

*)

echo "your input error"

esac

Shell腳本100例:10 編寫nginx啟動腳本


分享到:


相關文章: