1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-25 00:51:21 +00:00

Add new rc script, remove old rc script.

Submitted by:	Boris Kovalenko
This commit is contained in:
Bruce M Simpson 2003-11-22 13:37:35 +00:00
parent 14c03112ec
commit cc49a0f9d9
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=94708
2 changed files with 61 additions and 57 deletions

View File

@ -0,0 +1,61 @@
#!/bin/sh
#
# PROVIDE: quagga
# REQUIRE: netif routing
# KEYWORD: FreeBSD shutdown
#
# Add the following lines to /etc/rc.conf to enable quagga:
#
#quagga_enable="YES"
#
. %%RC_SUBR%%
name="quagga"
rcvar=`set_rcvar`
stop_postcmd=stop_postcmd
stop_postcmd()
{
rm -f $pidfile
}
# set defaults
quagga_enable=${quagga_enable:-"NO"}
quagga_flags=${quagga_flags:-"-d"}
load_rc_config $name
QUAGGA_DAEMONS="zebra ripd ripng ospfd ospf6d bgpd"
quagga_cmd=$1
case "$1" in
force*)
quagga_cmd=${quagga_cmd#force}
;;
fast*)
quagga_cmd=${quagga_cmd#fast}
;;
esac
if [ ${quagga_cmd} = "stop" ]; then
QUAGGA_DAEMONS=$(reverse_list ${QUAGGA_DAEMONS})
fi
for daemon in ${QUAGGA_DAEMONS}; do
command=%%PREFIX%%/sbin/${daemon}
required_files=%%SYSCONF_DIR%%/${daemon}.conf
pidfile=%%LOCALSTATE_DIR%%/${daemon}.pid
if [ ${quagga_cmd} = "start" -a ! -f ${required_files} ]; then
continue
fi
if [ ${quagga_cmd} = "stop" -a -z $(check_process ${command}) ]; then
continue
fi
run_rc_command "$1"
done

View File

@ -1,57 +0,0 @@
#! /bin/sh
#
# $FreeBSD: /tmp/pcvs/ports/net/quagga/files/Attic/zebractl.sh,v 1.2 2003-11-05 15:19:55 bms Exp $
#
# zebra start/stop script by "Andreas Klemm <andreas@FreeBSD.ORG>"
#
usage()
{
echo "$0: usage: $0 [ start | stop | restart ]"
exit 1
}
if [ $# -lt 1 ]; then
echo "$0: error: one argument needed"; usage
elif [ $# -gt 1 ]; then
echo "$0: error: only one argument needed"; usage
fi
case $1 in
start)
if [ ! -f !!SYSCONF_DIR!!/zebra.conf ]; then
echo "error: zebra.conf config file is mandatory"
exit 1
fi
[ -f !!SYSCONF_DIR!!/zebra.conf ] \
&& !!PREFIX!!/sbin/zebra -d && echo -n ' zebra'
[ -f !!SYSCONF_DIR!!/ripd.conf ] \
&& !!PREFIX!!/sbin/ripd -d && echo -n ' ripd'
[ -f !!SYSCONF_DIR!!/ripngd.conf ] \
&& !!PREFIX!!/sbin/ripngd -d && echo -n ' ripngd'
[ -f !!SYSCONF_DIR!!/ospfd.conf ] \
&& !!PREFIX!!/sbin/ospfd -d && echo -n ' ospfd'
[ -f !!SYSCONF_DIR!!/ospf6d.conf ] \
&& !!PREFIX!!/sbin/ospf6d -d && echo -n ' ospf6d'
[ -f !!SYSCONF_DIR!!/bgpd.conf ] \
&& !!PREFIX!!/sbin/bgpd -d && echo -n ' bgpd'
;;
stop)
[ -f !!SYSCONF_DIR!!/ripd.conf ] && killall ripd
[ -f !!SYSCONF_DIR!!/ripngd.conf ] && killall ripngd
[ -f !!SYSCONF_DIR!!/ospfd.conf ] && killall ospfd
[ -f !!SYSCONF_DIR!!/ospf6d.conf ] && killall ospf6d
[ -f !!SYSCONF_DIR!!/bgpd.conf ] && killall bgpd
[ -f !!SYSCONF_DIR!!/zebra.conf ] && killall zebra
;;
restart)
$0 stop
$0 start
;;
*) echo "$0: error: unknown option $1"
usage
;;
esac
exit 0