unfs3 is not parallel build safe
[openwrt/svn-archive/archive.git] / net / ucarp / files / ucarp.init
1 #!/bin/sh /etc/rc.common
2
3 START=50
4 CONF=/etc/ucarp.conf
5 IP=$(which ip)
6 UCARP=$(which ucarp)
7 ARPING=$(which arping)
8
9 start() {
10 . ${CONF}
11
12 [ ${BACKGROUND} = 1 ] && daemon="--daemonize"
13
14 cat > /var/run/ucarp-vip-up <<EOF
15 #!/bin/sh
16
17 $IP addr add ${VIP}/${VMASK} dev ${IF}
18
19 EOF
20 for ip in ${PINGIP}
21 do
22 cat >> /var/run/ucarp-vip-up <<EOF
23 $ARPING -c 2 -I ${IF} -s ${VIP} ${ip}
24 EOF
25 done
26 chmod a+x /var/run/ucarp-vip-up
27
28 cat > /var/run/ucarp-vip-down <<EOF
29 #!/bin/sh
30
31 $IP addr del ${VIP}/${VMASK} dev ${IF}
32
33 EOF
34 chmod a+x /var/run/ucarp-vip-down
35
36 $UCARP --interface=${IF} --srcip=${MYIP} --vhid=1 --pass=${PASSWORD} \
37 --addr=${VIP} --nomcast $daemon \
38 --upscript=/var/run/ucarp-vip-up --downscript=/var/run/ucarp-vip-down
39 }
40
41 stop() {
42 killall ucarp
43 }