#!/sbin/runscript # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ extra_commands="checkconfig" extra_started_commands="reload" depend() { need net use logger iptables } FWKNOP_CONFDIR=${FWKNOP_CONFDIR:-/etc/fwknop} FWKNOP_PIDFILE=${FWKNOP_PIDFILE:-/var/run/${SVCNAME}.pid} FWKNOP_BINARY=${FWKNOP_BINARY:-/usr/sbin/fwknopd} checkconfig() { if [ ! -e "${FWKNOP_CONFDIR}"/fwknopd.conf ] ; then eerror "You need ${FWKNOP_CONFDIR}/fwknopd.conf file to run ${SVCNAME}" eerror "There is a sample file in ${FWKNOP_CONFDIR}/fwknopd.conf.example" return 1 fi if [ ! -e "${FWKNOP_CONFDIR}"/access.conf ] ; then eerror "You need ${FWKNOP_CONFDIR}/access.conf file to run ${SVCNAME}" eerror "There is a sample file in ${FWKNOP_CONFDIR}/access.conf.example" return 1 fi } start() { checkconfig || return 1 ebegin "Starting ${SVCNAME}" start-stop-daemon --start \ --exec "${FWKNOP_BINARY}" \ -- --pid-file="${FWKNOP_PIDFILE}" "${FWKNOP_OPTS}" eend $? } stop() { if [ "${RC_CMD}" = "restart" ] ; then checkconfig || return 1 fi ebegin "Stopping ${SVCNAME}" start-stop-daemon --stop \ --pidfile "${FWKNOP_PIDFILE}" eend $? } reload() { checkconfig || return 1 ebegin "Reloading ${SVCNAME}" start-stop-daemon --quiet --exec "${FWKNOP_BINARY}" \ -- --pid-file "${FWKNOP_PIDFILE}" -R eend $? }