#!/bin/sh

LOGFILE=logs/fetch-all-buildinfos.txt

perl bin/fetch-all-buildinfos.pl >$LOGFILE 2>&1

# keep failed logs, and the last successful run to avoid filling the disk.
if ! grep SUCCESS $LOGFILE >/dev/null ; then
	echo "bin/fetch-all-buildinfos.pl failed:"
	cat $LOGFILE
	mv $LOGFILE $LOGFILE.`date +"%Y-%m-%d:%H-%M-%S"`
else
	touch $LOGFILE
	# rm $LOGFILE
fi
