CentOS6.8 x86_64bit shell scripting to simulate Nginx service startup and shutdown

Source: Internet
Author: User

Shell script simulates Nginx service startup and shutdown
Note: 3 slashes////is followed by a representation of the interpretation of the current statement, which must be removed in the actual script

#!/bin/bash///defines which scripting language interprets the following statement
[-f/etc/init.d/functions]&&. /etc/init.d/functions///Judge and load system functions
nginx= "/application/nginx/sbin/nginx"///nginx Service installation directory startup file
Start () {///define Start function
Instructions to be executed $nginx the///start function
}
Stop () {///define STOP function
Instructions to be executed $nginx-s stop//stop///stop function
}
Reload () {///define Reload function
Instructions to be executed $nginx-s reload///reload function
}
Case "$" in///case the value of the variable in the judgment statement "variable" in, calling the function defined above
Start
Start
;;/ End of current judgment, continue execution down
Stop
Stop
;;
Restart
Stop
Start
;;
Reload
Reload
;;
*///If the above variable value is not satisfied, then output echo after the content, the full path of the script
echo "usage:$0 {start|stop|restart|reload}"
Esac///case Judgment Statement End

CentOS6.8 x86_64bit shell scripting to simulate Nginx service startup and shutdown

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.