summaryrefslogtreecommitdiff
path: root/nginx/nginx.rc
blob: e595088df27481d23f3ceec94aadb533278b09a9 (plain)
    1 #!/bin/sh
    2 #
    3 # /etc/rc.d/nginx: start/stop the nginx daemon
    4 #
    5 
    6 SSD=/sbin/start-stop-daemon
    7 PROG=/usr/sbin/nginx
    8 PID=/var/run/nginx.pid
    9 
   10 case $1 in
   11     "start")
   12         $SSD --start --pidfile $PID --exec $PROG
   13         ;;
   14     "stop")
   15         $SSD --stop --retry 10 --pidfile $PID
   16         ;;
   17     "restart")
   18         $0 stop
   19         $0 start
   20         ;;
   21     "reload")
   22         $PROG -s reload
   23         ;;
   24     "status")
   25         $SSD --status --pidfile $PID
   26         case $? in
   27             0)
   28                 echo "$PROG is running with pid $(cat $PID)"
   29                 ;;
   30             1)
   31                 echo "$PROG is not running but pid file $PID exists"
   32                 ;;
   33             3)
   34                 echo "$PROG is not running"
   35                 ;;
   36             4)
   37                 echo "Unable to determine program status"
   38                 ;;
   39         esac
   40         ;;
   41     *)
   42         echo "Usage: $0 [start|stop|restart|status]"
   43         ;;
   44 esac

Generated by cgit