From 52d59b14a8d896806d1d5906f2a400e56871d11a Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Tue, 5 Jun 2012 16:55:58 -0600 Subject: [PATCH] avoid duplicates in points.log --- packages/mcp/service/pointsd/pointsd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/mcp/service/pointsd/pointsd b/packages/mcp/service/pointsd/pointsd index a6fc72f..a27e152 100755 --- a/packages/mcp/service/pointsd/pointsd +++ b/packages/mcp/service/pointsd/pointsd @@ -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