Code: Select all
#!/bin/sh
. /dtv/SGO.env
WAIT_NETWORK()
{        
while [ "$(route -n | grep -c UG)" -lt 1 ] ; do
             echo "SamyGO ntp: wait for network"
             sleep 1
done
}
#timezone
#Lietuva TZ='EET-2EEST-3,M3.5.0/3,M10.5.0/4'
TIMEZONE="GMT+2"
#TZ="set your timezone"
SET_TZ()
{
if [ `cat /dtv/SGO.env | grep -c "export TZ"` -gt 0 ]; then
	export TZ='$TIMEZONE'
else
	echo "export TZ='$TIMEZONE'" >> /dtv/SGO.env
	export TZ='$TIMEZONE'
fi
}
#ntp server
NTP_SERVER='85.25.105.106'
case $1 in
	start)
	WAIT_NETWORK
	SET_TZ
	ntpclient -s -h $NTP_SERVER -p 123
	;;
	stop)
	;;
	status)
	date
	echo TimeZone=$TZ
	;;
	*)
	echo "Usage: $0 {start|status}" 1>&2
	exit 0
	;;
esac
