summaryrefslogtreecommitdiff
path: root/nginx/nginx.rc
blob: 87aa6be578e1b57183775846205a210618e4fa62 (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     "status")
   22         $SSD --status --pidfile $PID
   23         case $? in
   24             0)
   25                 echo "$PROG is running with pid $(cat $PID)"
   26                 ;;
   27             1)
   28                 echo "$PROG is not running but pid file $PID exists"
   29                 ;;
   30             3)
   31                 echo "$PROG is not running"
   32                 ;;
   33             4)
   34                 echo "Unable to determine program status"
   35                 ;;
   36         esac
   37         ;;
   38     *)
   39         echo "Usage: $0 [start|stop|restart|status]"
   40         ;;
   41 esac

Generated by cgit