zoukankan      html  css  js  c++  java
  • Nginx 启动脚本

    Nginx 启动脚本
    1、vim /etc/init.d/nginx
    #!/bin/bash
    # chkconfig: - 30 21
    # description: http service.
    # Source Function Library
    . /etc/init.d/functions
    # Nginx Settings
    NGINX_SBIN="/usr/local/nginx/sbin/nginx"
    NGINX_CONF="/usr/local/nginx/conf/nginx.conf"
    NGINX_PID="/usr/local/nginx/logs/nginx.pid"
    RETVAL=0
    prog="Nginx"
    start() {
    echo -n $"Starting $prog: "
    mkdir -p /dev/shm/nginx_temp
    daemon $NGINX_SBIN -c $NGINX_CONF
    RETVAL=$?
    echo
    return $RETVAL
    }
    stop() {
    echo -n $"Stopping $prog: "
    killproc -p $NGINX_PID $NGINX_SBIN -TERM
    rm -rf /dev/shm/nginx_temp
    RETVAL=$?
    echo
    return $RETVAL
    }
    reload(){
    echo -n $"Reloading $prog: "
    killproc -p $NGINX_PID $NGINX_SBIN -HUP
    RETVAL=$?
    echo
    return $RETVAL
    }
    restart(){
    stop
    start
    }
    configtest(){
    $NGINX_SBIN -c $NGINX_CONF -t
    return 0
    }
    case "$1" in
    start)
    start
    ;;
    stop)
    stop
    ;;
    reload)
    reload
    ;;
    restart)
    restart
    ;;
    configtest)
    configtest
    ;;
    *)
    echo $"Usage: $0 {start|stop|reload|restart|configtest}"
    RETVAL=1
    esac
    exit $RETVAL
    Nginx启动脚本
    2、修改脚本权限:chmod 755 /etc/init.d/nginx
    3、加入chkconfig:chkconfig --add nginx
    4、设置开机自启:chkconfig nginx on
     
  • 相关阅读:
    每天进步一小点
    C# 类
    XML JavaScript
    基础XML
    多态,重载,重写
    数据结构
    sql server规范
    .net core 使用TimeZoneInfo类的时间与时间戳转换
    git 重命名文件与文件夹
    IDEA spring boot 开启热加载
  • 原文地址:https://www.cnblogs.com/xiangsikai/p/8393648.html
Copyright © 2011-2022 走看看