nginx作为Linux系统服务启动
#!/bin/bash # chkconfig: 2345 58 74 # description: nginx web server # processname: nginx # config: /usr/local/nginx/conf/nginx.conf # pidfile: /usr/local/nginx/log/nginx.pid # Source function library. . /etc/init.d/functions # Source netwo***ng configuration. . /etc/sysconfig/network if [ -f /etc/sysconfig/nginx ];then . /etc/sysconfig/nginx fi RETVAL=0 prog=”nginx” start() { # Check that netwo***ng is up. [ "$NETWO***NG" = "no" ] && exit 1 echo -n $”Starting $prog: ” daemon /usr/local/nginx/sbin/nginx $OPTIONS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nginx return $RETVAL } stop() { echo -n $”Shutting down $prog: ” killproc /usr/local/nginx/sbin/nginx RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/nginx return $RETVAL }
# See how we were called. case “$1″ in start) start ;; stop) stop ;; status) status nginx RETVAL=$? ;; restart|reload) stop start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/nginx ]; then stop start RETVAL=$? fi ;; *) echo $”Usage: $0 {start|stop|restart|condrestart|status}” RETVAL=3 esac exit $RETVAL 拥有帝国一切,皆有可能。欢迎访问phome.net |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |