blob: 47353e79f15b0a38f767064aedbfe192795a4670 (
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
|
#!/sbin/runscript
description="MultiISP load balancing and failover"
command=/usr/sbin/pingu
command_args="-d"
pidfile=/var/run/pingu/pingu.pid
route_rules=/etc/pingu/route-rules
rundir=${pidfile%/*}
depend() {
need net
after firewall
}
start_pre() {
if ! [ -f "$route_rules" ]; then
return 0
fi
sed -e 's/\#.*//' -e '/^$/d' "$route_rules" | while read line; do
ebegin "Adding route rule: $line"
ip rule add $line && echo $line >> $rundir/route-rules
eend
done
}
stop_post() {
if ! [ -f "$rundir"/route-rules ]; then
return 0
fi
while read line; do
ebegin "Removing route rule: $line"
ip rule del $line
eend
done < "$rundir"/route-rules
rm "$rundir"/route-rules
}
|