/etc/init.d/nginx footstep Boot file

Source: Internet
Author: User

#! /bin/sh# chkconfig:2345  -  -# Description:startup Script forNginx webserver on Debian. Placeinch/etc/INIT.D and# Run'update-rc.d-f nginx Defaults', or use the appropriate command on your# distro. For CentOS/redhat Run:'chkconfig--add Nginx'# # # BEGIN INIT info# provides:nginx# Required-Start: $all # Required-Stop: $all # Default-start:2 3 4 5# Default-stop:0 1 6# Short-description:starts the Nginx web server# description:starts nginxusingstart-stop-daemon### END INIT info# author:licess# website:http://lnmp.orgPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/Binname=Nginxnginx_bin=/usr/local/nginx/sbin/$NAMECONFIGFILE=/usr/local/nginx/conf/$NAME. Confpidfile=/usr/local/nginx/logs/$NAME. PID Case " $" inchstart) echo-N"starting $NAME ..."        ifNETSTAT-TNPL | grep-Q Nginx;then Echo"$NAME (PID ' pidof $NAME ') already running."Exit1fi $NGINX _bin-C $CONFIGFILEif["$?"!=0 ] ; Then Echo"failed"Exit1        ElseEcho" Done"fi;; Stop) Echo-N"stoping $NAME ..."        if! NETSTAT-TNPL | grep-q Nginx; then echo"$NAME is not running."Exit1fi $NGINX _bin-s Stopif["$?"!=0 ] ; Then Echo"failed. Use Force-quit"Exit1        ElseEcho" Done"fi;; Status)ifNETSTAT-TNPL | grep-q Nginx; then PID=' pidof nginx ' echo"$NAME (PID $PID) is running ..."        ElseEcho"$NAME is stopped"Exit0fi;; Force-quit) echo-N"terminating $NAME ..."        if! NETSTAT-TNPL | grep-q Nginx; then echo"$NAME is not running."Exit1fi kill ' pidof $NAME 'if["$?"!=0 ] ; Then Echo"failed"Exit1        ElseEcho" Done"fi;; Restart) $0Stop Sleep1        $0start;; Reload) echo-N"Reload service $NAME ..."        ifNETSTAT-TNPL | grep-q Nginx; then $NGINX _bin-s Reload Echo" Done"        ElseEcho"$NAME is not running, can ' t reload."Exit1fi;; Configtest) echo-N"Test $NAME Configure files ..."$NGINX _bin-T;; *) echo"Usage: $ {start|stop|force-quit|restart|reload|status|configtest}"Exit1        ;; Esac


Chkconfig--level 3 Nginx on

/etc/init.d/nginx footstep Boot file

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.