3 # nginx Nginx Web Server (@flavor@ version)
6 # description: Nginx is an HTTP(S) server, HTTP(S) reverse \
7 # proxy and IMAP/POP3 proxy server
8 # processname: nginx-@flavor@
9 # pidfile: /var/run/nginx-@flavor@.pid
10 # config: /etc/nginx/nginx-@flavor@.conf
12 # Source function library
13 . /etc/rc.d/init.d/functions
15 # Source networking configuration.
16 . /etc/sysconfig/network
18 nginx="/usr/sbin/nginx-@flavor@"
19 svname="nginx (@flavor@)"
22 sysconfig="/etc/sysconfig/$prog"
23 lockfile="/var/lock/subsys/$prog"
24 pidfile="/var/run/$prog.pid"
26 NGINX_CONF_FILE="/etc/nginx/$prog.conf"
29 [ -f $sysconfig ] && . $sysconfig
31 # Check that networking is up.
32 if is_yes "${NETWORKING}"; then
33 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
34 msg_network_down "$svname"
42 # Check if the service is already running?
43 if [ ! -f $lockfile ]; then
44 msg_starting "$svname"
45 daemon $nginx -c $NGINX_CONF_FILE
47 [ $RETVAL -eq 0 ] && touch $lockfile
49 msg_already_running "$svname"
55 if [ -f $lockfile ]; then
56 msg_stopping "$svname"
57 killproc --waitforname $prog --waitfortime 60 $prog
58 # Delete pidfile only when nginx was called successfully
60 rm -f $lockfile $pidfile >/dev/null 2>&1
63 msg_not_running "$svname"
68 if [ -f $lockfile ]; then
69 msg_reloading "$svname"
73 msg_not_running "$svname"
79 if [ ! -f $lockfile ]; then
80 msg_not_running "$svname"
90 # See how we were called.
105 reload|force-reload|graceful)
113 msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|status}"