]> git.pld-linux.org Git - packages/nginx.git/blame - nginx-light.init
- 1.0.2
[packages/nginx.git] / nginx-light.init
CommitLineData
e3557836 1#!/bin/sh
2#
3# nginx Nginx Web Server (light version)
4#
5# chkconfig: 345 85 15
6# description: Nginx is a World Wide Web server. It is used to serve \
7# HTML files and CGI.
8# processname: nginx-light
9# pidfile: /var/run/nginx-light.pid
10# config: /etc/nginx/nginx-light.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 msg_network_down nginx-light
26 exit 1
27 fi
28else
29 exit 0
30fi
31
32if [ -d "${HTTPD_CONF:-'/etc/nginx/nginx-light.conf'}" ]; then
33 CFG="-f ${HTTPD_CONF:-'/etc/nginx/nginx-light.conf'}"
34elif [ -n "$HTTPD_CONF" ]; then
35 echo "error: HTTPD_CONF='$HTTPD_CONF': not a file, not a directory"
36 exit 1
37else
38 CFG=""
39fi
40
41start() {
42 # Check if the service is already running?
43 if [ ! -f /var/lock/subsys/nginx-light ]; then
44 msg_starting nginx-light
45 daemon nginx-light $CFG $HTTPD_OPTS
46 RETVAL=$?
47 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nginx-light
48 else
49 msg_already_running nginx-light
50 fi
51}
52
53stop() {
54 # Stop daemons.
55 if [ -f /var/lock/subsys/nginx-light ]; then
56 msg_stopping nginx-light
57 killproc --waitforname nginx-light --waitfortime 60 nginx-light $CFG
58 # Delete pidfile only when nginx was called successfully
59 if [ $? -eq 0 ]; then
60 rm -f /var/lock/subsys/nginx-light /var/run/nginx-light.pid >/dev/null 2>&1
61 fi
62 else
63 msg_not_running nginx-light
64 fi
65}
66
67RETVAL=0
68# See how we were called.
69case "$1" in
70 start)
71 start
72 ;;
73 stop)
74 stop
75 ;;
76 status)
77 status nginx-light
78 RETVAL=$?
79 ;;
80 restart)
81 stop
82 start
83 ;;
84 reload|force-reload|graceful)
85 if [ -f /var/lock/subsys/nginx-light ]; then
86 msg_reloading nginx-light
87 killproc nginx-light -HUP
88 RETVAL=$?
89 else
90 msg_not_running nginx-light
91 RETVAL=7
92 fi
93 ;;
94 *)
95 msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|status}"
96 exit 3
97 ;;
98esac
99
100exit $RETVAL
This page took 0.061375 seconds and 4 git commands to generate.