myoverlay/net-vpn/softether/files/softether-bridge.initd

40 lines
1,012 B
Plaintext

#!/sbin/openrc-run
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
NAME=${SVCNAME##*.}
if [ -n "${NAME}" -a "${SVCNAME}" != "softether-bridge" ]; then
PID="/run/softether-bridge.${NAME}.pid"
PNAME=$(echo ${RC_SVCNAME} | sed 's/.*\-/vpn/;s/\..*//g')
CONF_DEFAULT="/etc/conf.d/softether-bridge.${NAME}"
else
PID="/run/softether-bridge.pid"
PNAME=$(echo ${RC_SVCNAME} | sed 's/.*\-/vpn/')
CONF_DEFAULT="/etc/conf.d/softether-bridge"
fi
CONF=${CONF:-${CONF_DEFAULT}}
EXEC=${EXEC:-/opt/softether/bin/vpnbridge/vpnbridge}
depend() {
need net
provide softether-bridge
}
start() {
ebegin "Starting softether-bridge"
start-stop-daemon --start --quiet --make-pidfile --pidfile ${PID} --exec ${EXEC} -- ${OPTS_START}
eend $?
}
start_post() {
pgrep -n $(echo ${PNAME}) > ${PID}
}
stop() {
ebegin "Stopping softether-bridge"
start-stop-daemon --stop --quiet --pidfile ${PID} -- ${OPTS_STOP}
rm -f ${PID}
eend $?
}