2009-01-29 16:24:13 +11:00
|
|
|
#
|
2015-11-23 21:05:51 -06:00
|
|
|
# /etc/rc.d/nginx: start, stop or restart nginx server
|
2009-01-29 16:24:13 +11:00
|
|
|
#
|
|
|
|
|
|
|
|
case $1 in
|
2009-01-29 16:40:39 +11:00
|
|
|
start)
|
2015-11-23 21:05:51 -06:00
|
|
|
PID="`pidof nginx`"
|
|
|
|
if [ -s /var/run/nginx.pid -a -n "$PID" ]; then
|
|
|
|
echo "nginx is already running"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
/usr/sbin/nginx
|
|
|
|
;;
|
2009-01-29 16:40:39 +11:00
|
|
|
stop)
|
2015-11-23 21:05:51 -06:00
|
|
|
/usr/sbin/nginx -s quit
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
$0 stop; sleep 1; $0 start
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
PID="`pidof nginx`"
|
|
|
|
if [ -s /var/run/nginx.pid -a -n "$PID" ]; then
|
|
|
|
echo "nginx is running. PID(s) = $PID"
|
|
|
|
else
|
|
|
|
echo "nginx is not running."
|
|
|
|
fi
|
|
|
|
;;
|
2009-01-29 16:40:39 +11:00
|
|
|
*)
|
2015-11-23 21:05:51 -06:00
|
|
|
echo "usage: nginx [start|stop|restart]"
|
|
|
|
;;
|
2009-01-29 16:24:13 +11:00
|
|
|
esac
|