#! /bin/sh

#
# This works on AIX only
#

convert=$HOME/globus-date2utc

whendate=`date "+%a %b %d 05:30:00 GMT %Y"`
whentime=`${convert} "${whendate}"`

while [ 1 -eq 1 ]; do
    nowdate=`date -u`
    nowtime=`${convert} "${nowdate}"`
    if [ ${nowtime} -gt ${whentime} ]; then
	(
	    start=`date -u` 
	    echo ""
	    echo "${start} : starting..."
	    nice -39 $HOME/bin/globus-test-suite aix -mdsorg "ou=Mathematics and Computer Science Division, o=Argonne National Laboratory, o=Globus, c=US" -mdspasswd MCSadmin -mcscron  -full ;
	    stop=`date -u`	    
	    a=`${convert} "${stop}"`
	    b=`${convert} "${start}"`
	    echo "${stop} : done, this took `expr ${a} - ${b}` seconds" 
	    echo ""
	    exit 0
	) &
	whentime=`expr 12 \* 60 \* 60 + ${whentime}`
    fi
    sleep `expr ${whentime} - ${nowtime}`
done

