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