#!/bin/sh

BIN=/opt/interm/bin
CONF=/opt/interm/conf

hwclock -su

if [ -x $BIN/xml_util ]; then
	tserver=`$BIN/xml_util -r -f $CONF/time.xml -t /config/timeserver/url`
	echo $tserver
	[ $? = 0 ] && /opt/interm/bin/ntpdate $tserver
	ping -c 1 -w 1 $tserver &> /dev/null
	if [ "$?" == "0" ] ; then
	$BIN/rlog -f /opt/interm/www/html/log/interm_log.dat -w "ping ok -> $tserver"
	else
	$BIN/rlog -f /opt/interm/www/html/log/interm_log.dat -w "ping error -> $tserver"
	fi
fi	
