3 # nginx Nginx Web Server
6 # description: Nginx is a World Wide Web server. It is used to serve \
9 # pidfile: /var/run/nginx.pid
10 # config: /etc/nginx/nginx.conf
13 # Source function library
14 . /etc/rc.d/init.d/functions
17 . /etc/sysconfig/network
20 [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
22 # Check that networking is up.
23 if is_yes "${NETWORKING}"; then
24 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
25 msg_network_down nginx
32 if [ -d "${HTTPD_CONF:-'/etc/nginx/nginx.conf'}" ]; then
33 CFG="-f ${HTTPD_CONF:-'/etc/nginx/nginx.conf'}"
34 elif [ -n "$HTTPD_CONF" ]; then
35 echo "error: HTTPD_CONF='$HTTPD_CONF': not a file, not a directory"
42 # Check if the service is already running?
43 if [ ! -f /var/lock/subsys/nginx ]; then
45 daemon nginx $CFG $HTTPD_OPTS
47 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nginx
49 msg_already_running nginx
55 if [ -f /var/lock/subsys/nginx ]; then
57 killproc --waitforname nginx --waitfortime 60 nginx $CFG
58 # Delete pidfile only when nginx was called successfully
60 rm -f /var/lock/subsys/nginx /var/run/nginx.pid >/dev/null 2>&1
68 # See how we were called.
84 reload|force-reload|graceful)
85 if [ -f /var/lock/subsys/nginx ]; then
95 msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|status}"