#!/bin/bash
[-f/etc/init.d/functions] &&. /etc/init.d/functions
Pid=/application/nginx/logs/nginx.pid
Nginx=/application/nginx/sbin/nginx
Red_color= ' \e[1;31m '
Green_color= ' \e[1;32m '
Yellow_color= ' \e[1;33m '
Blue_color= ' \e[1;34m '
pink= ' \e[1;35m '
Shan= ' \e[31;5m '
res= ' \e[0m '
Start () {
If [-f $pid]; Then
Action "Nginx is running"/bin/false
Else
$nginx
Action "Nginx start"/bin/true
Fi
}
Stop () {
if [!-f $pid]; Then
The action "Nginx has stopped"/bin/false
Else
$nginx-S Stop
Action "Nginx Stop"/bin/true
Fi
}
Reload () {
if [!-f $pid]; Then
The action "Nginx has stopped"/bin/false
Else
$nginx-S Reload
Action "Nginx restarted"/bin/true
Fi
}
Case "$" in
Start
Start
;;
Stop
Stop
;;
Reload
Reload
;;
Restart
Stop
Sleep 2
Start
;;
*)
Echo-e "${shan} brain remnant This is an example: $ (stop|start|reload|restart) $RES"
Esac
This article is from the "12216796" blog, please be sure to keep this source http://12226796.blog.51cto.com/12216796/1912242
Shell writes Ngin startup script