All pastes #393966 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-03-13 23:17 UTC
rendered paste body
#!/bin/sh
#
# bandwidth-monitor       Save/restore bandwidth usage
#
# chkconfig: 2345 20 20
# description: Save/restore bandwidth usage, for monitoring monthly usage
#
# processname: bandwidth-monitor
#
### BEGIN INIT INFO
# Provides: bandwidth-monitor
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Description: Save/restore bandwidth usage, for monitoring monthly usage
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

case "$1" in
    start)
    	gprintf "Starting bandwidth-monitor: "
	iptables-restore -n -c < /var/iptables-backup.txt
	success
	echo
        ;;
    stop)
    	gprintf "Stopping bandwidth-monitor: "
    	iptables-save -c | grep -A 3 filter > /var/iptables-backup.txt
	echo COMMIT >> /var/iptables-backup.txt
	success
	echo
        ;;
esac

exit 0