Shell writes Ngin startup script

Source: Internet
Author: User

#!/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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.