1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-23 09:10:43 +00:00
freebsd-ports/net/zebra/files/zebractl.in
Munechika SUMIKAWA d9a35a7f81 use $SUB_FILES to dynamically update zebractl
PR:		ports/143155
Submitted by:	Sevan Janiyan
2010-01-26 06:53:20 +00:00

58 lines
1.4 KiB
Bash

#! /bin/sh
#
# $FreeBSD: /tmp/pcvs/ports/net/zebra/files/zebractl.in,v 1.1 2010-01-26 06:53:20 sumikawa 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 %%ETCDIR%%/zebra.conf ]; then
echo "error: zebra.conf config file is mandatory"
exit 1
fi
[ -f %%ETCDIR%%/zebra.conf ] \
&& %%PREFIX%%/sbin/zebra -d && echo -n ' zebra'
[ -f %%ETCDIR%%/ripd.conf ] \
&& %%PREFIX%%/sbin/ripd -d && echo -n ' ripd'
[ -f %%ETCDIR%%/ripngd.conf ] \
&& %%PREFIX%%/sbin/ripngd -d && echo -n ' ripngd'
[ -f %%ETCDIR%%/ospfd.conf ] \
&& %%PREFIX%%/sbin/ospfd -d && echo -n ' ospfd'
[ -f %%ETCDIR%%/ospf6d.conf ] \
&& %%PREFIX%%/sbin/ospf6d -d && echo -n ' ospf6d'
[ -f %%ETCDIR%%/bgpd.conf ] \
&& %%PREFIX%%/sbin/bgpd -d && echo -n ' bgpd'
;;
stop)
[ -f %%ETCDIR%%/ripd.conf ] && killall ripd
[ -f %%ETCDIR%%/ripngd.conf ] && killall ripngd
[ -f %%ETCDIR%%/ospfd.conf ] && killall ospfd
[ -f %%ETCDIR%%/ospf6d.conf ] && killall ospf6d
[ -f %%ETCDIR%%/bgpd.conf ] && killall bgpd
[ -f %%ETCDIR%%/zebra.conf ] && killall zebra
;;
restart)
$0 stop
$0 start
;;
*) echo "$0: error: unknown option $1"
usage
;;
esac
exit 0