Upgrade babel to 0.13 (#3480) (#3478)
[packages.git] / ipv6 / babel / files / babel.init
1 #!/bin/sh /etc/rc.common
2
3 START=70
4
5 pidfile=/var/run/babel.pid
6
7 babel_config() {
8         local cfg="$1"
9         config_get interfaces "$cfg" interfaces
10 }
11
12 start() {
13         if [ -x /etc/init.d/ahcpd ] ; then
14                 echo 'Not starting babel -- will be started by ahcpd.'
15                 exit 0
16         fi
17         config_load babel
18         config_foreach babel_config babel
19         mkdir -p /var/lib
20         if [ -e $pidfile ] ; then
21                 echo "$pidfile exists -- not starting babel." >&2
22         else
23                 /usr/bin/babel -D -I $pidfile $interfaces
24         fi
25 }
26
27 stop() {
28         [ -e $pidfile ] && kill $(cat $pidfile)
29         [ -e $pidfile ] && sleep 2
30         [ -e $pidfile ] && sleep 4
31         [ -e $pidfile ] && echo "Failed to stop ahcpd ($pidfile still exists)."
32 }