gentoo-overlay/www-servers/cherokee/files/cherokee-initd-1.2.99

67 lines
1.2 KiB
Text

#!/sbin/openrc-run
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
command="/usr/sbin/cherokee"
extra_commands="configtest"
extra_started_commands="graceful reload"
depend() {
need net
use dns ldap logger mysql netmount
}
checkconfig() {
${command} -t 1>/dev/null 2>&1
ret=$?
if [ $ret -ne 0 ]; then
eerror "${SVCNAME} has detected an error in your config:"
${command} -t ${CHEROKEE_OPTS}
fi
return $?
}
configtest() {
ebegin "Checking ${SVCNAME} configuration"
checkconfig
eend $?
}
start() {
checkconfig || return 1
ebegin "Starting ${SVCNAME}"
start-stop-daemon --start --quiet \
--exec ${command} -- -d ${CHEROKEE_OPTS}
eend $?
}
stop() {
checkconfig || return 1
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --quiet \
--exec ${command}
eend $?
}
graceful() {
checkconfig || return 1
ebegin "Restarting ${SVCNAME} and closing all the opened connections"
start-stop-daemon \
--exec ${command} \
--signal USR1
eend $?
}
reload() {
checkconfig || return 1
ebegin "Reloading ${SVCNAME} configuration"
start-stop-daemon \
--exec ${command} \
--signal HUP
eend $?
}