#!/bin/sh
#  Pt-web/src/app-root/scripts/ntpSetDate.sh
# 
#  Copyright:  2016, Guralp Systems Ltd.
#  Author: Kelly Dunlop <kdunlop@guralp.com>
#  License: GPLv3
#

NTPHOST="ruthenium.platinum.guralp.com"


# Query first to check we can access the host because ntpdate alone always returns 0
ret=`ntpdate -q -u ${NTPHOST}`

if [ $? -eq 0 ]
then
	ntpdate -u ${NTPHOST}

	# Reset the hardware clock so a reboot doesn't lose the date
	hwclock -u -w
	exit 0
else
	exit 1
fi

# vim: ts=4:sw=4:expandtab
