#!/bin/sh

logfile=logs/container-info-logfile.txt

perl bin/container-info.pm > $logfile 2>&1

# keep failed logs, and the last successful run to avoid filling the disk.
if ! grep SUCCESS $logfile >/dev/null ; then
	echo "Note: This scripts occasionaly fails with out of memory ..."
	echo "bin/container-info.pl failed:"
	cat $logfile
	mv $logfile $logfile.`date +"%Y-%m-%d:%H-%M-%S"`
else
	touch $logfile
	#rm $logfile
	#mv $logfile $logfile.`date +"%Y-%m-%d:%H-%M-%S"`
fi

git status --porcelain data/containerids |grep "M " && git commit -m "container id update" data/containerids
