eventscripts: Use set_proc() to update /proc
authorMartin Schwenke <martin@meltin.net>
Fri, 7 Mar 2014 02:37:21 +0000 (13:37 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Wed, 26 Mar 2014 05:57:36 +0000 (16:57 +1100)
In case we want to write some unit tests in the future.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(Imported from commit 5519a05766ca9e0a8ace39c49661b9ad52440cac)

config/events.d/11.natgw

index 855500500bbb429cfb5b7496f212297a63f4454c..7424fd2e18ea3c31ee91bc94cb0ff95b24de10fb 100755 (executable)
@@ -66,7 +66,7 @@ case "$1" in
            die "ERROR: NATGW configured to use a public address. NATGW must not use a public address."
 
        # do not send out arp requests from loopback addresses
-       echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
+       set_proc sys/net/ipv4/conf/all/arp_announce 2
        ;;
 
     updatenatgw|ipreallocated)
@@ -79,7 +79,7 @@ case "$1" in
 
        if [ "$mypnn" = "$natgwmaster" ]; then
                # This is the NAT GW
-               echo 1 >/proc/sys/net/ipv4/ip_forward
+               set_proc sys/net/ipv4/ip_forward 1
                iptables -A POSTROUTING -t nat -s $CTDB_NATGW_PRIVATE_NETWORK ! -d $CTDB_NATGW_PRIVATE_NETWORK -j MASQUERADE
 
                # block all incoming connections to the natgw address
@@ -98,7 +98,7 @@ case "$1" in
        fi
 
        # flush our route cache
-       echo 1 > /proc/sys/net/ipv4/route/flush
+       set_proc sys/net/ipv4/route/flush 1
        ;;
 
     shutdown|removenatgw)