|
Lines 3-9
Link Here
|
| 3 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# Distributed under the terms of the GNU General Public License v2 |
| 4 |
# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/lighttpd.initd-1.4.13-r1,v 1.2 2007/01/09 20:56:24 robbat2 Exp $ |
4 |
# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/lighttpd.initd-1.4.13-r1,v 1.2 2007/01/09 20:56:24 robbat2 Exp $ |
| 5 |
|
5 |
|
| 6 |
opts="depend checkconfig start stop reload graceful" |
6 |
opts="reload graceful" |
| 7 |
|
7 |
|
| 8 |
depend() { |
8 |
depend() { |
| 9 |
need net |
9 |
need net |
|
Lines 13-19
Link Here
|
| 13 |
} |
13 |
} |
| 14 |
|
14 |
|
| 15 |
checkconfig() { |
15 |
checkconfig() { |
| 16 |
if [[ ! -f ${LIGHTTPD_CONF} ]] ; then |
16 |
if [ ! -f "${LIGHTTPD_CONF}" ] ; then |
| 17 |
ewarn "${LIGHTTPD_CONF} does not exist." |
17 |
ewarn "${LIGHTTPD_CONF} does not exist." |
| 18 |
return 1 |
18 |
return 1 |
| 19 |
fi |
19 |
fi |
|
Lines 26-71
Link Here
|
| 26 |
|
26 |
|
| 27 |
ebegin "Starting lighttpd" |
27 |
ebegin "Starting lighttpd" |
| 28 |
start-stop-daemon --start --quiet \ |
28 |
start-stop-daemon --start --quiet \ |
| 29 |
--background --pidfile ${LIGHTTPD_PID} \ |
29 |
--background --pidfile "${LIGHTTPD_PID}" \ |
| 30 |
--exec /usr/sbin/lighttpd -- -f ${LIGHTTPD_CONF} |
30 |
--exec /usr/sbin/lighttpd -- -f "${LIGHTTPD_CONF}" |
| 31 |
eend $? |
31 |
eend $? |
| 32 |
} |
32 |
} |
| 33 |
|
33 |
|
| 34 |
stop() { |
34 |
stop() { |
| 35 |
local rv=0 |
35 |
local rv=0 |
| 36 |
ebegin "Stopping lighttpd" |
36 |
ebegin "Stopping lighttpd" |
| 37 |
if start-stop-daemon --stop --quiet --pidfile ${LIGHTTPD_PID} \ |
37 |
start-stop-daemon --stop --quiet --pidfile "${LIGHTTPD_PID}" |
| 38 |
--signal 2 ; then |
38 |
eend $? |
| 39 |
rm -f ${LIGHTTPD_PID} |
|
|
| 40 |
else |
| 41 |
rv=1 |
| 42 |
fi |
| 43 |
eend $rv |
| 44 |
} |
39 |
} |
| 45 |
|
40 |
|
| 46 |
reload() { |
41 |
reload() { |
| 47 |
if [ ! -f ${LIGHTTPD_PID} ]; then |
42 |
if ! service_started "${SVCNAME}" ; then |
| 48 |
eerror "lighttpd isn't running" |
43 |
eerror "${SVCNAME} isn't running" |
| 49 |
return 1 |
44 |
return 1 |
| 50 |
fi |
45 |
fi |
| 51 |
checkconfig || return 1 |
46 |
checkconfig || return 1 |
|
|
47 |
|
| 52 |
ebegin "Re-opening lighttpd log files" |
48 |
ebegin "Re-opening lighttpd log files" |
| 53 |
kill -HUP $(<${LIGHTTPD_PID}) &>/dev/null |
49 |
start-stop-daemon --stop --oknodo --quiet --pidfile "${LIGHTTPD_PID}" \ |
|
|
50 |
--signal HUP |
| 54 |
eend $? |
51 |
eend $? |
| 55 |
} |
52 |
} |
| 56 |
|
53 |
|
| 57 |
graceful() { |
54 |
graceful() { |
| 58 |
if ! service_started "${myservice}" ; then |
55 |
if ! service_started "${SVCNAME}" ; then |
| 59 |
eerror "Lighttpd is not running! Please start it before trying to reload it." |
56 |
eerror "${SVCNAME} isn't running" |
| 60 |
else |
57 |
return 1 |
| 61 |
checkconfig || return 1 |
58 |
fi |
| 62 |
ebegin "Gracefully stopping lighttpd" |
59 |
checkconfig || return 1 |
| 63 |
## s-s-d for consistency or kill because it's cleaner? |
60 |
|
| 64 |
## s-s-d causes a 5 second delay here |
61 |
ebegin "Gracefully stopping lighttpd" |
| 65 |
#start-stop-daemon --stop --quiet --pidfile ${LIGHTTPD_PID} \ |
62 |
start-stop-daemon --stop --oknodo --quiet --pidfile "${LIGHTTPD_PID}" \ |
| 66 |
# --signal SIGINT |
63 |
--signal INT |
| 67 |
kill -INT $(<${LIGHTTPD_PID}) |
64 |
if eend $? ; then |
| 68 |
rm -f ${LIGHTTPD_PID} |
65 |
rm -f "${LIGHTTPD_PID}" |
| 69 |
start |
66 |
start |
| 70 |
fi |
67 |
fi |
| 71 |
} |
68 |
} |