Source code of /package/share/maintenance/testcases/status_short

Last modified: 2014-12-03 16:33:35

Download

#!/bin/bash

#
#  generic Whois - Maintenance Framework: Testcases
#
#  (c) 2012-2014 Daniel Marschall, ViaThinkSoft [www.viathinksoft.de]
#
#  Distribution, usage etc. pp. regulated by the current version of GPL.
#
#
#  Version 2014-08-19
#

DIR=$( dirname "$0" )

. /etc/gwhois/maintenance/testcases.conf

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";

        tsfile="/var/cache/gwhois/maintenance/testcases/checktimestamps/$query"
        errfile="/var/cache/gwhois/maintenance/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 < /etc/gwhois/maintenance/testcases.list

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