nginx启动脚本

nginx 本身不带启动脚本,这个脚本适应于linux&unix,
#!/bin/sh
### the shell program is nginx start!!! 2008-10-23 chunming
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/opt/csw/bin:/var/nginx/sbin
NAME=nginx

DAEMON=/var/nginx/sbin/nginx
PIDFILE=/var/nginx/logs/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
[ -x "$DAEMON" ] || exit 0
do_start()
{
      if [ -f $PIDFILE ]; then
         echo “Nginx program is runing!!!”
        exit 1
       else  
        $DAEMON
        echo “Nginx program is the successful start!!! “
       fi
        
}

do_stop()
{
        if  [ -f $PIDFILE ]; then
          kill `cat $PIDFILE`
          rm -f $PIDFILE
          echo “Nginx program is stoping”
         else  
            echo “Nginx program is not runing!!!”
        fi
}

do_reload ()
{
        if [ -f $PIDFILE ]; then
           kill -HUP `cat $PIDFILE`
           echo “Nginx program is reload”
        else
           echo “Nginx program is not runing!!!”
        fi
}
case “$1″ in
  start)
    do_start
    ;;
  stop)
    do_stop
    ;;
  restart)
    do_stop
    do_start
    ;;
  reload)
    do_reload
    ;;
  *)
    echo “Usage: $SCRIPTNAME {start|stop|restart|reload}” >&2
    ;;
esac

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/21041/showart_1333084.html

原创文章,转载请注明: 转载自PT Ubuntu Blog

本文链接地址: http://www.ptubuntu.com/2008/11/360.html

  • Share/Bookmark

Leave a Reply


Verify Code   If you cannot see the CheckCode image,please refresh the page again!

Powered by WordPress | Buy free cell phones from at&t. | Thanks to PalmPreBlog.com, MMO Games and Conveyancing