updated on Tue Jan 10 04:01:21 UTC 2012
[aur-mirror.git] / quagga-lisg / zebra
blob00c9a76ab1d1ff22fea227ed899e95edd8728b7c
1 #!/bin/bash
3 # GNU Zebra Routing Manager/RIP/RIPng/OSPF/OSPF6/BGPD4 start/stop script
5 # based on AUR/community/quagga 0.99.1-1 port template script
6 # by shild, shildv at gmail dot com
9 DNAME="zebra"
10 PORT="2601"
12 PID="`pidof -o %PPID /usr/sbin/$DNAME`"
14 . /etc/rc.conf
15 . /etc/rc.d/functions
17 . /etc/conf.d/quagga
19 case $1 in
20 start)
21 stat_busy "Starting Quagga $DNAME daemon"
23 if [ -z "$PID" -a -f /etc/quagga.d/$DNAME.conf ]
24 then
25 /usr/sbin/$DNAME -d \
26 -f /etc/quagga.d/$DNAME.conf \
27 -i /var/run/quagga/$DNAME.pid \
28 -A 127.0.0.1 \
29 -P $PORT \
30 -u quagga \
31 -g quagga
33 if [ $cpulimit_zebra = 1 ]
34 then
35 /usr/bin/cpulimit -P /usr/sbin/$DNAME -l $zebra_cpu -z \
36 > /dev/null 2> /dev/null &
39 sleep 1; # Wait for forking (PID changes)
41 PID="`pidof -o %PPID /usr/sbin/$DNAME`"
42 if [ -z "$PID" ]
43 then
44 stat_fail
45 else
46 add_daemon $DNAME
47 stat_done
50 else
51 stat_fail
54 stop)
55 stat_busy "Stopping Quagga $DNAME daemon"
57 [ ! -z "$PID" ] && kill "$PID" &> /dev/null
59 if [ $? -gt 0 ]
60 then
61 stat_fail
62 else
63 rm_daemon $DNAME
64 stat_done
67 sleep 1
69 restart)
70 $0 stop
71 sleep 1
72 $0 start
75 echo "usage: $0 [start|stop|restart]"
76 esac
78 exit 0
80 # EOF