mirror of
https://github.com/samba-team/samba.git
synced 2025-03-26 18:50:30 +03:00
Eventscripts: Clean up 11.routing
The loops can all be done without cat or grep. The pair of loops in updateip is combined into a single loop. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 96fdda124f5511fb76190e7c7a7f0b98e6b01a31)
This commit is contained in:
parent
3c5374a5c2
commit
35de9f2583
@ -21,20 +21,19 @@ loadconfig
|
||||
|
||||
case "$1" in
|
||||
recovered|ipreallocated)
|
||||
cat $CTDB_BASE/static-routes | while read IFACE DEST GW; do
|
||||
ip route add $DEST via $GW dev $IFACE >/dev/null 2>/dev/null
|
||||
done
|
||||
while read iface dest gw; do
|
||||
ip route add "$dest" via "$gw" dev "$iface" >/dev/null 2>&1
|
||||
done <"${CTDB_BASE}/static-routes"
|
||||
;;
|
||||
|
||||
updateip)
|
||||
oiface=$2
|
||||
niface=$3
|
||||
cat $CTDB_BASE/static-routes | egrep "^$niface " | while read IFACE DEST GW; do
|
||||
ip route add $DEST via $GW dev $IFACE >/dev/null 2>/dev/null
|
||||
done
|
||||
cat $CTDB_BASE/static-routes | egrep "^$oiface " | while read IFACE DEST GW; do
|
||||
ip route add $DEST via $GW dev $IFACE >/dev/null 2>/dev/null
|
||||
done
|
||||
while read iface dest gw; do
|
||||
if [ "$niface" = "$iface" -o "$oiface" = "$iface" ] ; then
|
||||
ip route add "$dest" via "$gw" dev "$iface" >/dev/null 2>&1
|
||||
fi
|
||||
done <"${CTDB_BASE}/static-routes"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
Loading…
x
Reference in New Issue
Block a user