avoid duplicates in points.log

This commit is contained in:
Neale Pickett 2012-06-05 16:55:58 -06:00
parent 7d7d2afc2d
commit 52d59b14a8
1 changed files with 4 additions and 2 deletions

View File

@ -4,8 +4,10 @@ fn=$2/$3
POINTS=/var/lib/ctf/points.log
SCOREBOARD=/var/www/scoreboard.html
cat $fn >> $POINTS || break
rm $fn
# Only do this if this score hasn't yet been recorded
if ! cut -d' ' -f2- $POINTS | grep -Fqx "$(cut -d' ' -f2- $fn)"; then
cat $fn >> $POINTS && rm $fn
fi
# Render scoreboard
if [ $POINTS -nt $SCOREBOARD ]; then