Page 1 of 1
ntpclient
Posted: Sat Jul 16, 2016 11:14 pm
by fraglord
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?
Re: ntpclient
Posted: Tue Jul 26, 2016 1:19 pm
by hu8200
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:
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/
Re: ntpclient
Posted: Mon Aug 01, 2016 10:12 am
by Marflow
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/
?
Re: ntpclient
Posted: Mon Aug 01, 2016 6:36 pm
by hu8200
before last line
Re: ntpclient
Posted: Tue Aug 02, 2016 9:42 am
by Marflow
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.

Re: ntpclient
Posted: Wed Aug 03, 2016 9:03 pm
by hu8200
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.
Re: ntpclient
Posted: Thu Aug 04, 2016 11:38 am
by Marflow
Both modifications don't work..

TV freeze.
Re: ntpclient
Posted: Thu Nov 17, 2016 3:27 pm
by fraglord
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!