#! /bin/sh # First argument is seconds between running everything cycle=${1:-60} POINTS=var/points/log cd $(dirname $0)/.. while true; do # Timestamp start=$(date +%s) next=$(expr $start + $cycle) # If enabled, run tanks if ! [ -f var/disabled/tanks ]; then sbin/run-tanks --no-barren-points --once var/tanks fi # Collect any new points for fn in var/points/cur/*; do [ -f $fn ] || continue cat $fn >> $POINTS || break rm $fn done # Update the scoreboard if [ -f $POINTS ]; then sbin/scoreboard -t www/scoreboard.html -j www/myplot.js < $POINTS fi # Wait until the next minute now=$(date +%s) if [ $now -lt $next ]; then sleep $(expr $next - $now) fi done