ntpclient

Here for general support for H series TVs, request and problem solve area.
Post Reply

fraglord
SamyGO Project Donor
Posts: 68
Joined: Mon Jan 05, 2015 2:30 pm

ntpclient

Post by fraglord » Sat Jul 16, 2016 11:14 pm

My 07_11_ntpclient.init looks like that

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
The timezone is set to 'GMT+2'. But 'date' and 'date -u' both report the UTC time instead of the local time. How to correct this?
*** UE40H6470 *** F/W: T-MST14DEUC-2130.0 *** OTA & OTN disabled ***

hu8200
SamyGO Project Donor
Posts: 26
Joined: Wed Dec 31, 2014 1:10 am

Re: ntpclient

Post by hu8200 » Tue Jul 26, 2016 1:19 pm

first of all read about differences http://www.timeanddate.com/time/gmt-utc-time.html
second, find ntp server for your country http://www.pool.ntp.org and change it

1. for oscam LiveLog you need to set correct TIMEZONE="GMT-2" (Poland in summer is GMT+2 but TIMEZONE="GMT-2" oscam showing correct time)
2. for date and date -u commands you need to copy file with timezone right for your country from https://www.iana.org/time-zones (you need compile it), or copy from other linux (/usr/share/zoneinfo) - my is in attachment

a) first, try manual way (works until reboot)
find symlink target for localtime on TV:

Code: Select all

ls -l /etc/ | grep localtime
you can't change it because is read only filesystem, but you can change target of symlink:
copy right timezone data right for your country to /tmp folder and change its name of target from previous command (my was CSP_TimeZone)
try date and date -u
b) automatic (change script run.sh or run1.sh in SamyGo folder)
copy the file that you have prepared to folder SamyGo on rooting pendrive and add this line to run.sh or run1.sh (i have modified skype root and i have another script) but probably best way is put in run.sh before line with execute run1.sh

Code: Select all

/bin/cp "$1/SamyGO/CSP_TimeZone" /tmp/
You do not have the required permissions to view the files attached to this post.

Marflow
SamyGO Project Donor
Posts: 60
Joined: Wed Nov 11, 2015 6:40 pm
Location: PL

Re: ntpclient

Post by Marflow » Mon Aug 01, 2016 10:12 am

My run.sh looks like this:

Code: Select all

#!/bin/sh
#/bin/sleep 30
echo OK > /tmp/rooted
echo OK > "$1/SamyGO/getroot.ok"
/bin/busybox sync

/bin/rm  "$1/SamyGO/sam.log"

/bin/sh -x "$1/SamyGO/sfd.sh" "$1" >> "$1/SamyGO/sam.log"  2>&1

if [ -e "$1/SamyGO/ext3.sh" ]
then
    /bin/sh -x "$1/SamyGO/ext3.sh" "$1" >> "$1/SamyGO/sam.log"  2>&1
fi

if [ -e "$1/SamyGO/lan.sh" ]
then
    /bin/sh -x "$1/SamyGO/lan.sh" "$1" >> "$1/SamyGO/sam.log"  2>&1
fi

/bin/sh -x "$1/SamyGO/run1.sh" "$1" >> "$1/SamyGO/sam.log"  2>&1
Where to paste this line:

Code: Select all

/bin/cp "$1/SamyGO/CSP_TimeZone" /tmp/
?
40H6500
T-MST14DEUC-2130 (network root)
OTN off

hu8200
SamyGO Project Donor
Posts: 26
Joined: Wed Dec 31, 2014 1:10 am

Re: ntpclient

Post by hu8200 » Mon Aug 01, 2016 6:36 pm

before last line

Marflow
SamyGO Project Donor
Posts: 60
Joined: Wed Nov 11, 2015 6:40 pm
Location: PL

Re: ntpclient

Post by Marflow » Tue Aug 02, 2016 9:42 am

Like this?

Code: Select all

#!/bin/sh
#/bin/sleep 30
echo OK > /tmp/rooted
echo OK > "$1/SamyGO/getroot.ok"
/bin/busybox sync

/bin/rm  "$1/SamyGO/sam.log"

/bin/sh -x "$1/SamyGO/sfd.sh" "$1" >> "$1/SamyGO/sam.log"  2>&1

if [ -e "$1/SamyGO/ext3.sh" ]
then
    /bin/sh -x "$1/SamyGO/ext3.sh" "$1" >> "$1/SamyGO/sam.log"  2>&1
fi

if [ -e "$1/SamyGO/lan.sh" ]
then
    /bin/sh -x "$1/SamyGO/lan.sh" "$1" >> "$1/SamyGO/sam.log"  2>&1
fi

/bin/cp "$1/SamyGO/CSP_TimeZone" /tmp/
/bin/sh -x "$1/SamyGO/run1.sh" "$1" >> "$1/SamyGO/sam.log"  2>&1
TV freeze. :(
40H6500
T-MST14DEUC-2130 (network root)
OTN off

hu8200
SamyGO Project Donor
Posts: 26
Joined: Wed Dec 31, 2014 1:10 am

Re: ntpclient

Post by hu8200 » Wed Aug 03, 2016 9:03 pm

Try

Code: Select all

if [ -e "$1/SamyGO/CSP_TimeZone" ]
then
    /bin/cp "$1/SamyGO/CSP_TimeZone" /tmp/
fi
Or try on top of script (below this line) /bin/rm "$1/SamyGO/sam.log"
Check sam.log on SamyGO folder
"/bin/cp" command simply copy file "CSP_TimeZone" from SamyGO folder to /tmp folder in tv. You can try in different locations. It's safe.

Marflow
SamyGO Project Donor
Posts: 60
Joined: Wed Nov 11, 2015 6:40 pm
Location: PL

Re: ntpclient

Post by Marflow » Thu Aug 04, 2016 11:38 am

Both modifications don't work.. :( TV freeze.
40H6500
T-MST14DEUC-2130 (network root)
OTN off

fraglord
SamyGO Project Donor
Posts: 68
Joined: Mon Jan 05, 2015 2:30 pm

Re: ntpclient

Post by fraglord » Thu Nov 17, 2016 3:27 pm

Any progress on this?
I played around and I wonder now my 07_11_ntpclient.init is not executed on startup anymore at all :(

But anyways I noticed when you enable the ntpclient then most of the smart hub apps will not work anymore!
I guess it is not neccessary to have a proper systemtime for oscam to work so better leave the ntp client disabled!
*** UE40H6470 *** F/W: T-MST14DEUC-2130.0 *** OTA & OTN disabled ***

Post Reply

Return to “[H] Support”