在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
复制代码 代码如下: #! /bin/sh ### BEGIN INIT INFO # Provides: nginx # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: nginx init.d dash script for Ubuntu or other *nix. # Description: nginx init.d dash script for Ubuntu or other *nix. ### END INIT INFO #------------------------------------------------------------------------------ # nginx - this Debian Almquist shell (dash) script, starts and stops the nginx # daemon for Ubuntu and other *nix releases. # # description: Nginx is an HTTP(S) server, HTTP(S) reverse \ # proxy and IMAP/POP3 proxy server. This \ # script will manage the initiation of the \ # server and it's process state. # # processname: nginx # config: /usr/local/nginx/conf/nginx.conf # pidfile: /usr/local/nginx/logs/nginx.pid # Provides: nginx # # Author: Jason Giedymin # <jason.giedymin AT gmail.com>. # # Version: 3.5.1 11-NOV-2013 jason.giedymin AT gmail.com # Notes: nginx init.d dash script for Ubuntu. # Tested with: Ubuntu 13.10, nginx-1.4.3 # # This script's project home is: # http://github.com/JasonGiedymin/nginx-init-ubuntu # #------------------------------------------------------------------------------ # MIT X11 License #------------------------------------------------------------------------------ # # Copyright (c) 2008-2013 Jason Giedymin, http://jasongiedymin.com # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Test that init functions exists . $LSB_FUNC #------------------------------------------------------------------------------ PS="nginx" DESCRIPTION="Nginx Server..." RUNAS=root #user to run as SCRIPT_OK=0 #ala error codes lockfile=/var/lock/subsys/nginx #------------------------------------------------------------------------------ # Test if nginx is a file and executable # Include nginx defaults if available #set exit condition #------------------------------------------------------------------------------ setFilePerms(){ configtest() { getPSCount() { isRunning() { if [ $PID -gt 0 ]; then if [ $PID -gt 0 ]; then #courtesy of php-fpm while test $try -lt 35 ; do 'removed') try=`expr $try + 1` status(){ if [ "${isAlive}" -eq $TRUE ]; then return removePIDFile(){ start() { return stop() { wait_for_pid 'removed' $PIDSPATH/$PIDFILE if [ -n "$try" ]; then return reload() { log_daemon_msg "Reloading (via HUP) $DESCRIPTION" isRunning if [ $? -eq $TRUE ]; then return quietupgrade() { isRunning if [ "${isAlive}" -eq $TRUE ]; then log_end_msg $SCRIPT_OK kill -HUP `cat $PIDSPATH/$PIDFILE` wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin log_end_msg $SCRIPT_OK return terminate() { [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` for i in $PIDS; do log_end_msg $SCRIPT_OK destroy() { pidof_daemon() { [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` for i in $PIDS; do return 0 action="$1" exit $rc |
请发表评论