freebsd-ports/security/tinc/files/tincd.sh.in
Dirk Meyer 6f43108f08 - fix reload and restart targets
Submitted by:i	igor <soft[at]antrax-energo.msk.ru>
2008-12-30 14:04:59 +00:00

81 lines
1.3 KiB
Bash

#!/bin/sh
#
# PROVIDE: tincd
# REQUIRE: ipfilter FILESYSTEMS sysctl netif
# BEFORE: SERVERS routing
# KEYWORD: nojail
# Define these tincd_* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
# /etc/rc.conf.d/threeproxy
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
tincd_enable=${tincd_enable:-"NO"}
. /etc/rc.subr
name="tincd"
rcvar=`set_rcvar`
command="%%PREFIX%%/sbin/tincd"
start_cmd="tincd_start"
stop_cmd="tincd_stop"
reload_cmd="tincd_reload"
extra_commands="reload"
procname=${command:-tincd}
load_rc_config $name
tincd_start()
{
if test -z "${tincd_cfg}"
then
echo "Starting tincd"
$command
else
for cfg in ${tincd_cfg}
do
echo "Starting tincd for: ${cfg}"
$command -n $cfg
done
fi
# code deliberately borrowed from /etc/rc.d/netif
if [ -f /etc/rc.d/ipfilter ] ; then
# Resync ipfilter
/etc/rc.d/ipfilter resync
fi
}
tincd_stop()
{
if test -z "${tincd_cfg}"
then
echo "Stopping tincd"
$command -k
else
echo "Stopping tincd for: "
for cfg in $tincd_cfg
do
echo "Stopping tincd for: ${cfg}"
$command -n $cfg -k
done
fi
}
tincd_reload()
{
if test -z "${tincd_cfg}"
then
echo "Sending HUP to tincd"
$command --kill=HUP
else
for cfg in $tincd_cfg
do
echo "Sending HUP to tincd for: ${cfg}"
$command -n $cfg --kill=HUP
done
fi
}
run_rc_command "$1"
# eof