Scripting nginx start

bin # / bash!
# Function: This scripting completed, placed in the /etc/init.d/ directory can be the Linux system to automatically recognize the script.
# If this script is named /etc/init.d/ nginx, the service nginx start you can start the service
# author: liusingbon
#service nginx STOP | restart | Status can shut down, restart, see Nginx services
Program = / usr / local / nginx / sbin / nginx
pid = / usr / local / Nginx / logs / nginx.pid
function Start {
               IF [-f $ PID]; the then
                  echo "service disable state Nginx"
               the else
                  $ Program
               Fi
            }
function {STOP
              IF [- PID -f $!]; the then
                 echo "Nginx services have been shut down "
              the else
                 $ STOP Program -s
                 echo" shut down the service ok "
              Fi
             }
function Status {
                IF [-f $ PID]; the then
                   echo "service is running ..."
                the else
                   echo "service has been closed"
                Fi
}
Case $. 1 in
Start)
       Start ;;
STOP)
       STOP ;;
the restart)
       STOP
       SLEEP. 1
       ;; Start
Status)
       Status ;;
*)
       echo "syntax you entered is incorrect"
esac

Guess you like

Origin www.cnblogs.com/liusingbon/p/11079515.html