You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-misc/portfwd/files/portfwd.init

39 lines
773 B

#!/sbin/openrc-run
depend() {
need net
}
checkconfig() {
if [ ! -e /etc/portfwd.cfg ] ; then
eerror "You need an /etc/portfwd.cfg file first"
eerror "There are samples in the documentation directory"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting portfwd"
start-stop-daemon --start --quiet --pidfile /var/run/portfwd.pid --exec /usr/sbin/portfwd -- ${PORTFWD_OPTS}
_pid="`ps -C portfwd -o pid= | head -n 1`"
if [ -n "$_pid" ] ; then
echo "${_pid/ /}" > /var/run/portfwd.pid
eend 0
else
eend 1
fi
}
stop() {
ebegin "Stopping portfwd"
start-stop-daemon --stop --quiet --pidfile /var/run/portfwd.pid
if [ $? -eq 0 ]; then
rm -f /var/run/portfwd.pid
fi
eend $?
}