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