/[apache]/trunk/dist/2.0/init/apache2.initd
Gentoo

Contents of /trunk/dist/2.0/init/apache2.initd

Parent Directory Parent Directory | Revision Log Revision Log


Revision 93 - (show annotations) (download)
Wed Nov 1 17:13:32 2006 UTC (7 years, 11 months ago) by vericgar
File size: 2221 byte(s)
Fix a typo
1 #!/sbin/runscript
2 # Copyright 1999-2005 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 opts="${opts} reload configtest"
6
7 # this next comment is important, don't remove it - it has to be somewhere in
8 # the init script to kill off a warning that doesn't apply to us
9 # svc_start svc_stop
10
11 depend() {
12 need net
13 use mysql dns logger netmount postgresql
14 after sshd
15 }
16
17 configtest() {
18 ebegin "Checking Apache Configuration"
19 checkconfig
20 eend $?
21 }
22
23 checkconfig() {
24
25 SERVERROOT="${SERVERROOT:-/usr/lib/apache2}"
26 if [ ! -d ${SERVERROOT} ]; then
27 eerror "SERVERROOT does not exist: ${SERVERROOT}"
28 return 1
29 fi
30
31 CONFIGFILE="${CONFIGFILE:-/etc/apache2/httpd.conf}"
32 [ ${CONFIGFILE:0:1} != "/" ] && CONFIGFILE="${SERVERROOT}/${CONFIGFILE}"
33 if [ ! -r "${CONFIGFILE}" ]; then
34 eerror "Unable to read configuration file: ${CONFIGFILE}"
35 return 1
36 fi
37
38
39 APACHE2_OPTS="${APACHE2_OPTS} -d ${SERVERROOT}"
40 APACHE2_OPTS="${APACHE2_OPTS} -f ${CONFIGFILE}"
41 [ -n "${STARTUPERRORLOG}" ] && APACHE2_OPTS="${APACHE2_OPTS} -E ${STARTUPERRORLOG}"
42
43 # set a sane default for KEEPENV and OLDENV
44 KEEPENV=${KEEPENV:-PATH}
45 OLDENV=
46
47 for env_var in ${KEEPENV}; do
48 OLDENV="${OLDENV} ${env_var}=\"`printenv ${env_var}`\""
49 SSDENV="${SSDENV} --env ${env_var}=\"`printenv ${env_var}`\""
50 done
51
52 APACHE2="/usr/sbin/apache2"
53
54 env -i ${OLDENV} ${APACHE2} ${APACHE2_OPTS} -t 1>/dev/null 2>&1
55 ret=$?
56 if [ $ret -ne 0 ]; then
57 eerror "Apache2 has detected a syntax error in your configuration files:"
58 ${APACHE2} ${APACHE2_OPTS} -t
59 fi
60
61 return $ret
62 }
63
64 start() {
65 checkconfig || return 1
66 ebegin "Starting apache2"
67 [ -f /var/log/apache2/ssl_scache ] && rm /var/log/apache2/ssl_scache
68 env -i /sbin/start-stop-daemon --start --exec ${APACHE2} --pidfile /var/run/apache2.pid ${SSDENV} -- ${APACHE2_OPTS} -k start
69 eend $?
70 }
71
72 stop() {
73 checkconfig || return 1
74 ebegin "Stopping apache2"
75 /sbin/start-stop-daemon --stop --retry -TERM/5/-TERM/5/-KILL/5 --exec ${APACHE2} --pidfile /var/run/apache2.pid
76 eend $?
77 }
78
79 reload() {
80 checkconfig || return 1
81 ebegin "Doing a graceful restart of apache2"
82 /sbin/start-stop-daemon --stop --signal USR1 --exec ${APACHE2} --pidfile /var/run/apache2.pid
83 eend $?
84 }

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20