diff --git a/bin/once b/bin/once index a5e9332..1f40248 100755 --- a/bin/once +++ b/bin/once @@ -16,11 +16,17 @@ fi # Collect new points find state/points.new -type f | while read fn; do - # Skip partially-written files - [ $(wc -l < $fn) -eq 1 ] || continue + # Skip files opened by another process + lsof $fn | grep -q $fn && continue + + # Skip partially written files + [ $(wc -l < $fn) -gt 0 ] || continue - cat $fn >> state/points.log - rm $fn + # filter the file for unique awards + sort -k 4 $fn | uniq -f 1 | sort -n >> state/points.log + + # Now kill the file + rm -f $fn done # Generate new puzzles.html