Vi/etc/init.d/nginx
Content additions:
1#! /bin/bash
2
3# Chkconfig: * - the
4# Description:nginx is an HTTP (s) server, HTTP (s) reverse
5
6Set-e
7Path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
8Desc="nginx Daemon"
9Name=nginx
Tendaemon=/usr/local/nginx/$NAME
OneScriptname=/etc/init.d/$NAME
A
-Test-x $DAEMON | | Exit0
-
theD_start () {
-$DAEMON | |Echo-N"already running"
-}
-
+D_stop () {
-$DAEMON-S Quit | |Echo-N"Not running"
+}
A
atD_reload () {
-$DAEMON-S Reload | |Echo-N"counld not reload"
-}
-
- Case" $"inch
-Start
in Echo-N"starting $DESC: $NAME"
-D_start
toEcho"."
+;;
-Stop
the Echo-N"stopping $DESC: $NAME"
*D_stop
$Echo"."
Panax Notoginseng;;
-Reload
theEcho-N"Reloading $DESC Configuration ..."
+D_reload
AEcho"Reloaded."
the;;
+Restart
-Echo-N"restarting $DESC: $NAME"
$D_stop
$Sleep2
-D_start
-Echo"."
the;;
-*)
WuyiEcho"Usage: $SCRIPTNAME {start|stop|restart|reload}">&2
theExit3
-;;
WuEsac
-
AboutExit0
Modify the address of the 10th Nginx execution.
Start Nginx:service nginx Start
Stop Nginx:service Nginx Stop
Configuring Nginx for system service (centos6.4)