freebsd-ports/net/xorp/files/xorp.in
Antoine Brodin 54dc2eefda - Update to 1.8.5
- Unbreak and unexpire
- Stage support

PR:		ports/186982
Submitted by:	Johannes 5 Joemann
2014-02-26 21:54:59 +00:00

76 lines
1.6 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# A sample XORP startup script.
#
# PROVIDE: xorp
# REQUIRE: netif routing mountcritlocal ldconfig
# BEFORE: NETWORKING
# KEYWORD: shutdown
# Add the following line to /etc/rc.conf to enable xorp:
#
# xorp_enable="YES"
#
# Note: You have to create a config file before you can start xorp!
# Set ${xorp_conf} to its location, the default is defined below.
#
# Besides the xorp_* variables which you'll find below with their
# default values, you can also define the following in rc.conf:
#
# xorp_rtprio=n
#
# This will run the xorp processes with realtime priority n, see rtprio(1).
. /etc/rc.subr
name=xorp
rcvar=xorp_enable
load_rc_config $name
: ${xorp_enable:=NO}
: ${xorp_conf=%%PREFIX%%/etc/xorp.conf}
: ${xorp_rtrmgr_pidfile=/var/run/xorp_rtrmgr.pid}
: ${xorp_rtrmgr_logfile=/var/log/xorp_rtrmgr.log}
: ${xorp_flags=-l ${xorp_rtrmgr_logfile}}
: ${xorp_hardkill_enable:=NO}
required_files=${xorp_conf}
command=%%PREFIX%%/sbin/xorp_rtrmgr
pidfile=${xorp_rtrmgr_pidfile}
logfile=${xorp_rtrmgr_logfile}
command_args="-d -c ${xorp_conf} -P ${pidfile}"
sig_stop=INT
start_precmd=xorp_prestart
stop_postcmd=xorp_poststop
xorp_prestart()
{
[ -z ${logfile} ] || [ -f ${logfile} ] || touch ${logfile}
# required for rtprio(1) until handled like nice(1) by rc.subr(8)
if [ -n "$xorp_rtprio" ] && [ "$xorp_rtprio" -ge 0 ]
then
rc_flags="$xorp_rtprio $command $xorp_flags"
command=/usr/sbin/rtprio
fi
return 0
}
xorp_poststop()
{
rm -f ${pidfile} >/dev/null 2>&1 || true
checkyesno xorp_hardkill_enable || return 0
killall -9 -m xorp_\* || true
return 0
}
run_rc_command "$1"