]> git.pld-linux.org Git - packages/xtables-addons.git/blobdiff - ipset.init
- O: ipset-init.
[packages/xtables-addons.git] / ipset.init
index 98ca9e3302e7acc50e5950c347831ba1fd4aba49..2fe2342b53542f5d50ade3873fe60ab803ee158c 100644 (file)
@@ -18,7 +18,14 @@ fi
 start() {
        if [ -f $IPSET_CONFIG ]; then
                show "Applying ipset rules"
-               /usr/sbin/ipset -R $IPSET_CONFIG && ok || fail
+               /usr/sbin/ipset -X
+               /usr/sbin/ipset -R < $IPSET_CONFIG
+               RETVAL=$?
+               if [ $RETVAL = 0 ]; then
+                       ok
+               else
+                       fail
+               fi
                touch /var/lock/subsys/ipset
        fi
 }
@@ -29,6 +36,7 @@ stop() {
        rm -f /var/lock/subsys/ipset
 }
 
+RETVAL=0
 case "$1" in
   start)
        start
@@ -41,16 +49,23 @@ case "$1" in
        ;;
   status)
        /usr/sbin/ipset -L --sorted --numeric
+       exit $?
        ;;
   save)
        show "Saving current rules to %s" $IPSET_CONFIG
        touch $IPSET_CONFIG
        chmod 600 $IPSET_CONFIG
-       /usr/sbin/ipset -S > $IPSET_CONFIG  2>/dev/null && ok || fail
+       /usr/sbin/ipset -S > $IPSET_CONFIG
+       RETVAL=$?
+       if [ $RETVAL = 0 ]; then
+               ok
+       else
+               fail
+       fi
        ;;
   *)
        msg_usage "$0 {start|stop|restart|force-reload|status|save}"
        exit 3
 esac
 
-exit 0
+exit $RETVAL
This page took 0.299366 seconds and 4 git commands to generate.