Subversion Repositories vgwhois

Rev

Rev 5 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

#!/bin/bash

#
#  VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois)
#  Maintenance / Developer utilities
#
#  (c) 2012-2019 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
#
#  License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2)
#

DIR=$( dirname "$0" )

. "$DIR/../../config/testcases.conf"

CACHE_DIR="$DIR/../../.cache"
TESTCASES_LIST="$DIR/../../config/testcases.list"

count=0

while read f; do
        if [ -z "$f" ]; then
                continue;
        fi

        echo "$f" | grep -E "\s*^#" > /dev/null
        if [ $? -eq 0 ]; then
                continue;
        fi

        # Warum? "tld jp" wird dann zu "tld"
        # query="$( basename $f )"
        query="$f";

        if [ ! -d "$CACHE_DIR/testcases/checktimestamps" ]; then
                mkdir -p "$CACHE_DIR/testcases/checktimestamps"
        fi
        tsfile="$CACHE_DIR/testcases/checktimestamps/$query"

        if [ ! -d "$CACHE_DIR/testcases/problems" ]; then
                mkdir -p "$CACHE_DIR/testcases/problems"
        fi
        errfile="$CACHE_DIR/testcases/problems/$query"

        if [ ! -f "$tsfile" ]; then
                ((count++));
        elif [ ! -f "$tsfile" ] || [ $( stat --format=%Y "$tsfile" ) -le $(( $( date +%s ) - $recheck_time )) ]; then
                ((count++));
        elif [ -f "$errfile" ]; then
                ((count++));
        fi

done < "$TESTCASES_LIST"

if [ $count -eq 0 ]; then
        echo "[ OK ]"
        exit 0
else
        echo "[ !! ] $count testcases require attention"
        exit 1
fi