mirror of https://github.com/dirtbags/moth.git
35 lines
698 B
Bash
Executable File
35 lines
698 B
Bash
Executable File
#! /bin/sh
|
|
|
|
cd $(dirname $0)/..
|
|
|
|
# Do nothing if `disabled` is present
|
|
if [ -f disabled ]; then
|
|
exit
|
|
fi
|
|
|
|
# Reset to initial state if `reset` is present
|
|
if [ -f reset ]; then
|
|
rm -f state/teams/* state/points.new/* state/points.tmp/*
|
|
: > state/points.log
|
|
rm -f reset
|
|
fi
|
|
|
|
# Collect new points
|
|
find state/points.new -type f | while read fn; do
|
|
# Skip partially-written files
|
|
[ $(wc -l < $fn) -eq 1 ] || continue
|
|
|
|
cat $fn >> state/points.log
|
|
rm $fn
|
|
done
|
|
|
|
# Generate new puzzles.html
|
|
if www/cgi-bin/puzzles.cgi > www/puzzles.new; then
|
|
mv www/puzzles.new www/puzzles.html
|
|
fi
|
|
|
|
# Generate new points.json
|
|
if bin/points state/points.log > www/points.new; then
|
|
mv www/points.new www/points.json
|
|
fi
|