| 1 |
#!/sbin/runscript
|
| 2 |
# Copyright 1999-2012 Gentoo Foundation
|
| 3 |
# Distributed under the terms of the GNU General Public License v2
|
| 4 |
# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/files/tincd.lo.1,v 1.4 2012/02/02 20:29:33 blueness Exp $
|
| 5 |
|
| 6 |
extra_started_commands="reload"
|
| 7 |
|
| 8 |
DAEMON="/usr/sbin/tincd"
|
| 9 |
|
| 10 |
depend() {
|
| 11 |
use logger dns
|
| 12 |
need net
|
| 13 |
}
|
| 14 |
|
| 15 |
start() {
|
| 16 |
NETNAME="${RC_SVCNAME#*.}"
|
| 17 |
CONFIG="/etc/tinc/${NETNAME}/tinc.conf"
|
| 18 |
PIDFILE="/var/run/tinc.${NETNAME}.pid"
|
| 19 |
if [ ! -f "${CONFIG}" ]; then
|
| 20 |
eerror "Cannot start network ${NETNAME}."
|
| 21 |
eerror "Please set up ${CONFIG} !"
|
| 22 |
else
|
| 23 |
ebegin "Starting tinc network $NETNAME"
|
| 24 |
if [ "${SYSLOG}" == "yes" ]; then
|
| 25 |
LOG=""
|
| 26 |
else
|
| 27 |
LOG="--logfile=/var/log/tinc.${NETNAME}.log"
|
| 28 |
fi
|
| 29 |
start-stop-daemon --start --exec "${DAEMON}" --pidfile "${PIDFILE}" -- --net="${NETNAME}" "${LOG}" --pidfile "${PIDFILE}"
|
| 30 |
eend $?
|
| 31 |
fi
|
| 32 |
}
|
| 33 |
|
| 34 |
stop() {
|
| 35 |
NETNAME="${RC_SVCNAME#*.}"
|
| 36 |
CONFIG="/etc/tinc/${NETNAME}/tinc.conf"
|
| 37 |
PIDFILE="/var/run/tinc.${NETNAME}.pid"
|
| 38 |
if [ -f "${PIDFILE}" ] ; then
|
| 39 |
ebegin "Stopping tinc network ${NETNAME}"
|
| 40 |
start-stop-daemon --stop --pidfile "${PIDFILE}"
|
| 41 |
eend $?
|
| 42 |
fi
|
| 43 |
}
|
| 44 |
|
| 45 |
reload() {
|
| 46 |
NETNAME=${RC_SVCNAME#*.}
|
| 47 |
CONFIG="/etc/tinc/${NETNAME}/tinc.conf"
|
| 48 |
PIDFILE="/var/run/tinc.${NETNAME}.pid"
|
| 49 |
if [ -f "${PIDFILE}" ] ; then
|
| 50 |
ebegin "Reloading tinc network ${NETNAME}"
|
| 51 |
start-stop-daemon --signal HUP --pidfile "${PIDFILE}"
|
| 52 |
eend $?
|
| 53 |
fi
|
| 54 |
}
|