summaryrefslogtreecommitdiffstats
path: root/net/quagga/files/quagga.sh
blob: caef30d1d60adf13d87cfa3b4bd34a5beb05e320 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
#

# PROVIDE: quagga
# REQUIRE: netif routing mountcritlocal
# BEFORE:  NETWORKING
# KEYWORD: FreeBSD NetBSD

#
# Add the following lines to /etc/rc.conf to enable quagga:
#
#quagga_enable="YES"
#
# You may also use next flags to tune startup
#quagga_flags="-d"
#quagga_daemons="zebra ripd ripng ospfd ospf6d bgpd isisd"
#

. %%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"}
quagga_daemons=${quagga_daemons:-"zebra ripd ripng ospfd ospf6d bgpd isisd"}
load_rc_config $name

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
OpenPOWER on IntegriCloud