源码安装Nginx服务启动脚本
2018-03-08 13:03
513 查看
#!/bin/bash # nginx Startup script for the Nginx HTTP Server # it is v.0.0.2 version. # chkconfig: 2345 08 99 # description: Nginx is a high-performance web and proxy server. # It has a lot of features, but it's not for everyone. # processname: nginx # pidfile: /var/run/nginx.pid # config: /usr/local/nginx/conf/nginx.conf nginxd=/usr/local/nginx/sbin/nginx nginx_config=/usr/local/nginx/conf/nginx.conf nginx_pid=/usr/local/nginx/logs/nginx.pid RETVAL=0 prog="nginx" # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 [ -x $nginxd ] || exit 0 # Start nginx daemons functions. start() { if [ -e $nginx_pid ];then echo "nginx already running...." exit 1 fi echo -n $"Starting $prog: " daemon $nginxd -c ${nginx_config} RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx return $RETVAL } # Stop nginx daemons functions. stop() { echo -n $"Stopping $prog: " killproc $nginxd RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid } # reload nginx service functions. reload() { echo -n $"Reloading $prog: " #kill -HUP `cat ${nginx_pid}` killproc $nginxd -HUP RETVAL=$? echo } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) stop start ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $prog {start|stop|restart|reload|status|help}" exit 1 esac exit $RETVAL
相关文章推荐
- linux APACHE2.2.10源码安装服务自动启动脚本
- squid源码安装的服务启动脚本
- nginx编译安装服务启动脚本示例
- 安装apached源码包以及编写shell脚本使其启动更加方便,并且和启动系统服务相同
- Nginx服务安装与启动脚本配置
- Nginx服务安装与启动脚本配置
- Nginx 启动、停止服务的脚本
- Nginx 源码-启动脚本!
- Android在init.rc中加入脚本开机安装APK并启动APK的服务
- CentOS6.8 x86_64bit shell脚本实现模拟nginx服务启动与关闭
- Nginx的系统启动服务脚本(shell)
- python33下运行的nginx服务启动脚本
- nginx 安装、编写启动脚本、配置
- nginx 服务启动脚本
- nginx服务启动脚本
- 源码编译安装Nginx服务
- SHELL编程---安装NGINX服务器并启动脚本
- CentOS源码包安装apache、nginx服务
- Ubantu15.04 安装Nginx启动服务无法访问localhost
- linux 命令系列之 基于源码包安装服务的启动(67)