#!/bin/bash
#      ipvsadm-restore - Restore IPVS rules
#
#      A very simple wrapper to restore IPVS rules
#      Inspired by ipchains-save.
#
#      Version: $Id: ipvsadm-restore,v 1.3 2002/08/10 04:32:38 wensong Exp $
#
#      Script Author: Horms <horms@vergenet.net>
#
#      This file:
#
#      ChangeLog
#      Horms               :        Clear IPVS rules before adding from STDIN
#      Horms               :        Filter out "^#"
#
#

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

# All the work is actually done in ipvsadm, hooray

INPUT="$(grep -v '^#')"
ipvsadm -C
echo "$INPUT" | ipvsadm -R

