"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "share/arno-iptables-firewall/plugins/traffic-accounting-log-rotate" between
aif-2.1.0.tar.gz and aif-2.1.1.tar.gz

About: Arno’s iptables firewall is a stateful firewall script for both single and multi-homed machines with DSL/ADSL support.

traffic-accounting-log-rotate  (aif-2.1.0):traffic-accounting-log-rotate  (aif-2.1.1)
skipping to change at line 12 skipping to change at line 12
log_file="/var/log/traffic-accounting.log" log_file="/var/log/traffic-accounting.log"
keeps=13 keeps=13
log_rotate() log_rotate()
{ {
# $1 = filename # $1 = filename
# $2 = keep count # $2 = keep count
filename="$1" filename="$1"
if [ -e "$filename.$2" ]; then if [ -f "$filename.$2" ]; then
rm -f "$filename.$2" rm -f "$filename.$2"
fi fi
for x in `seq $(($2 + 1)) -1 1`; do for x in `seq $(($2 + 1)) -1 1`; do
if [ -e "$filename.$x" ]; then if [ -f "$filename.$x" ]; then
mv "$filename.$x" "$filename.$(($x + 1))" mv "$filename.$x" "$filename.$(($x + 1))"
fi fi
done done
if [ -e "$filename" ]; then if [ -f "$filename" ]; then
mv "$filename" "$filename.1" mv "$filename" "$filename.1"
# Reset counters # Reset counters
cat "$filename.1" |awk '{ print $1" "$2" 0 0" }' > "$filename" cat "$filename.1" |awk '{ print $1" "$2" 0 0" }' > "$filename"
fi fi
} }
# main # main
log_rotate "$log_file" $keeps log_rotate "$log_file" $keeps
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)