aboutsummaryrefslogtreecommitdiffstats
path: root/main/pingu/pingu.initd
diff options
context:
space:
mode:
Diffstat (limited to 'main/pingu/pingu.initd')
-rw-r--r--main/pingu/pingu.initd25
1 files changed, 25 insertions, 0 deletions
diff --git a/main/pingu/pingu.initd b/main/pingu/pingu.initd
index a7a6bef369..47353e79f1 100644
--- a/main/pingu/pingu.initd
+++ b/main/pingu/pingu.initd
@@ -4,8 +4,33 @@ 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
+}