]> git.pld-linux.org Git - packages/nginx.git/blame - nginx.init
- a patch
[packages/nginx.git] / nginx.init
CommitLineData
b9f99299 1#!/bin/sh
2#
3# nginx Nginx Web Server
4#
5# chkconfig: 345 85 15
6# description: Apache is a World Wide Web server. It is used to serve \
7# HTML files and CGI.
8# processname: nginx
9# pidfile: /var/run/nginx.pid
10# config: /etc/nginx/nginx.conf
11
12
13# Source function library
14. /etc/rc.d/init.d/functions
15
16# Get network config
17. /etc/sysconfig/network
18
19# Get service config
20[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
21
22# Check that networking is up.
23if is_yes "${NETWORKING}"; then
24 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
25 # nls "ERROR: Networking is down. %s can't be run." <service>
26 msg_network_down nginx
27 exit 1
28 fi
29else
30 exit 0
31fi
32
33if [ -d "${HTTPD_CONF:-'/etc/nginx/nginx.conf'}" ]; then
34 CFG="-f ${HTTPD_CONF:-'/etc/nginx/nginx.conf'}"
35elif [ -n "$HTTPD_CONF" ]; then
36 echo "error: HTTPD_CONF='$HTTPD_CONF': not a file, not a directory"
37 exit 1
38else
39 CFG=""
40fi
41
42RETVAL=0
43# See how we were called.
44case "$1" in
45 start)
46 # Check if the service is already running?
47 if [ ! -f /var/lock/subsys/nginx ]; then
48 msg_starting nginx
49 daemon nginx $CFG $HTTPD_OPTS
50 RETVAL=$?
51 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nginx
52 else
53 msg_already_running nginx
54 fi
55 ;;
56 stop)
57 # Stop daemons.
58 if [ -f /var/lock/subsys/nginx ]; then
59 msg_stopping nginx.${HTTPD_MPM}
60 killproc --waitforname nginx --waitfortime 60 nginx $CFG
61 # Delete pidfile only when nginx was called successfully
62 if [ $? -eq 0 ]; then
63 rm -f /var/lock/subsys/nginx /var/run/nginx.pid /var/run/nginx.loc* >/dev/null 2>&1
64 fi
65 else
66 msg_not_running nginx
67 fi
68 ;;
69 status)
70 status nginx
71 RETVAL=$?
72 ;;
73 restart)
74 $0 stop
75 $0 start
76 ;;
77 reload|force-reload|graceful)
78 if [ -f /var/lock/subsys/nginx ]; then
79 msg_reloading nginx
80 killproc nginx "-HUP"
81 RETVAL=$?
82 else
83 msg_not_running nginx >&2
84 RETVAL=7
85 fi
86 ;;
87 *)
88 msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|status}"
89 exit 3
90 ;;
91esac
92
93exit $RETVAL
This page took 0.042523 seconds and 4 git commands to generate.