SHOW:
|
|
- or go back to the newest paste.
| 1 | #!/sbin/openrc-run | |
| 2 | # Copyright 1999-2012 Gentoo Foundation | |
| 3 | # Distributed under the terms of the GNU General Public License v2 | |
| 4 | # $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/lighttpd.initd,v 1.21 2012/01/08 20:45:46 woarang Exp $ | |
| 5 | ||
| 6 | depend() {
| |
| 7 | need net | |
| 8 | use mysql logger spawn-fcgi ldap slapd netmount dns | |
| 9 | after firewall | |
| 10 | after famd | |
| 11 | after sshd | |
| 12 | } | |
| 13 | ||
| 14 | checkconfig() {
| |
| 15 | if [ ! -f "${LIGHTTPD_CONF}" ] ; then
| |
| 16 | ewarn "${LIGHTTPD_CONF} does not exist."
| |
| 17 | return 1 | |
| 18 | fi | |
| 19 | ||
| 20 | if [ -z "${LIGHTTPD_PID}" ] ; then
| |
| 21 | ewarn "server.pid-file variable in ${LIGHTTPD_CONF}"
| |
| 22 | ewarn "is not set. Falling back to lighttpd.pid" | |
| 23 | LIGHTTPD_PID="/run/lighttpd.pid" | |
| 24 | fi | |
| 25 | /usr/sbin/lighttpd -t -f ${LIGHTTPD_CONF} >/dev/null
| |
| 26 | } | |
| 27 | ||
| 28 | start() {
| |
| 29 | checkconfig || return 1 | |
| 30 | checkpath -d -q -m 0750 -o lighttpd:lighttpd /run/lighttpd/ | |
| 31 | ||
| 32 | ebegin "Starting lighttpd" | |
| 33 | start-stop-daemon --start --quiet --exec /usr/sbin/lighttpd \ | |
| 34 | --pidfile "${LIGHTTPD_PID}" -- -f "${LIGHTTPD_CONF}"
| |
| 35 | eend $? | |
| 36 | } | |
| 37 | ||
| 38 | stop() {
| |
| 39 | local rv=0 | |
| 40 | ebegin "Stopping lighttpd" | |
| 41 | start-stop-daemon --stop --quiet --pidfile "${LIGHTTPD_PID}"
| |
| 42 | eend $? | |
| 43 | } | |
| 44 | ||
| 45 | reload() {
| |
| 46 | if ! service_started "${SVCNAME}" ; then
| |
| 47 | eerror "${SVCNAME} isn't running"
| |
| 48 | return 1 | |
| 49 | fi | |
| 50 | checkconfig || return 1 | |
| 51 | ||
| 52 | ebegin "Re-opening lighttpd log files" | |
| 53 | start-stop-daemon --quiet --pidfile "${LIGHTTPD_PID}" \
| |
| 54 | --signal HUP | |
| 55 | eend $? | |
| 56 | } | |
| 57 | ||
| 58 | graceful() {
| |
| 59 | if ! service_started "${SVCNAME}" ; then
| |
| 60 | eerror "${SVCNAME} isn't running"
| |
| 61 | return 1 | |
| 62 | fi | |
| 63 | checkconfig || return 1 | |
| 64 | ||
| 65 | ebegin "Gracefully stopping lighttpd" | |
| 66 | start-stop-daemon --quiet --pidfile "${LIGHTTPD_PID}" \
| |
| 67 | --signal INT | |
| 68 | if eend $? ; then | |
| 69 | rm -f "${LIGHTTPD_PID}"
| |
| 70 | start | |
| 71 | fi | |
| 72 | } |