DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2009-04-02 21:16:51

duby
Member
Registered: 2009-03-12
Posts: 8

timeproblem

i have the dns-323 with firmware 1.06 and ffp0.5 running and when i looked at the time it is 1 hour behind,NTP Server is on also EU Daylight Saving Time.i can switch to computertime,then its ok.but i would like to run it with ntp.
anybody aware of this small problem?
i changed the timezone to get the right time but that couldn´t be a solution:)
duby

Offline

 

#2 2009-04-05 11:59:30

silversurfer
Member
Registered: 2008-07-20
Posts: 95

Re: timeproblem

Actually the option "NTP Server" on the web interface is a one time only sync with a NTP server on the network. I believe that it uses ntpdate to set the time once when you click "Set Time". It doesn't use the ntpd daemon for syncing periodically.
That means that the time on your NAS will differ from the real time increasingly over time (the internal clock of the unit is quite bad). There was also a bug which set the time 1 hour off during night when "Daylight Saving Time" was set to something other than "None". I don't know if this is fixed in version 1.06 of the firmware.

Basically you have two options to keep your time in sync with a time server.

1. Use ntpd from the ntp package which you can download from Fonz' download page for funplug. -> http://www.inreto.de/dns323/fun-plug/0.5/packages/
Of course you will have to install and configure it to your needs.

I used the ntpd for some time but ntpd seems to cause trouble with custom made fan scripts which enable turning the fans off completely. You can read about that here.
That's why I switched to option 2.


2. Use ntpdate to set the time with the help of the cron scheduler. Add another entry to cron telling it to run ntpdate at whatever interval you want. This is also described at the above mentioned thread in this post for example.

Offline

 

#3 2009-04-20 14:55:17

faethon
Member
Registered: 2009-04-20
Posts: 11

Re: timeproblem

I have the same problem, where the time is one hour off. Tried to fix it using the information from this thread: http://dns323.kood.org/forum/t609-Clock-drift.html

The thread explains how to change the crontab to remove the 2 original 'rtc' jobs (to sync RTC to system) and the 1 'daylight' job, and replace it with a new RTC job (to write system to RTC) and a periodically sntp job (to get time from an ntp server).

Seemed ok yesterday, however this morning I found out that the NAS again changed the time overnight (setting it back one hour). I have now unchecked the NTP option in the web GUI, see if that changes anything tomorrow...

Would anybody who was able to solve this problem want to share his solution?

Offline

 

#4 2009-04-20 17:52:25

skydreamer
Member
From: At the Atlantic Coast
Registered: 2007-01-06
Posts: 232

Re: timeproblem

It has been discussed on this forum quite extensively.

As long as you force the ntpd to use slow skew it is not going to interfere with the fan script.

I have it running on both DNS-323 FW1.06 and the drift seem to have settled down:

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*timeserver    134.226.81.3     2 u   68 1024  377   10.039   -9.172   0.236
LOCAL(0)        .LOCL.          10 l    8   64  377    0.000    0.000   0.004

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*timeserver    134.226.81.3     2 u  783 1024  377    0.460    7.642   6.058
LOCAL(0)        .LOCL.          10 l   59   64  377    0.000    0.000   0.004


While the fancontrol interface is still working:

temperature g 0
Temperature type : Centigrade
<temperaturertc>: get temperature = 44

Offline

 

#5 2009-04-20 21:36:51

talkingRock
Member
Registered: 2009-03-26
Posts: 100

Re: timeproblem

I had this problem as well. 
I needed to do two things to fix it.

First, set up a cron job that runs:   
     ntpd -q -g
once per day.    You will need an ntp.conf file in /ffp/etc which names the servers.

Second, in your fun_plug, copy into the /etc/TZ file the correct data for your timezone.    It looks like the 323 ships with old timezone info, at least in the US.

Offline

 

#6 2009-04-21 08:23:59

faethon
Member
Registered: 2009-04-20
Posts: 11

Re: timeproblem

It actually seems that my NAS did not change the time (wrongly) overnight. Yesterday I unchecked the 'use NTP server' option in the TIME setup in the Web GUI. Together with setting the correct /etc/TZ at boot and removing the default cron jobs and adding my own sntp job seems to work now. Will let it run for a couple of days to see if it is really fixed now.

For completeness and maybe for someone else who is looking for a solution: this is what my current configuration is:

My current crontab looks like this:

Code:

32 2 * * * /usr/sbin/rtc -w
2  * * * * /usr/sbin/sntp -r -P no pool.ntp.org &

my /etc/TZ (this is for the Netherlands: GMT+1)

Code:

CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00

I have the following editcron.sh script run at boot to setup the crontab:

Code:

#!/bin/sh

CRONTXT=/mnt/HD_a2/tmp/crontab.txt

# start with existing crontab
/bin/crontab -l > $CRONTXT

# add a job to sync RTC with system time once per day
# and add a job that sets system time using SNTP hourly
/bin/echo "32 2 * * * /usr/sbin/rtc -w" >> $CRONTXT
/bin/echo "2  * * * * /usr/sbin/sntp -r -P no pool.ntp.org &" >> $CRONTXT

# install the new crontab
/bin/crontab $CRONTXT

# clean up
/bin/rm $CRONTXT

and the following fun_plug.local:

Code:

#!/ffp/bin/sh

BINDIR=/ffp/bin
LOGFILE=/mnt/HD_a2/ffp.log
ETCDIR=/etc

#SET the TZ for CET
TZ=CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00
export TZ
echo ${TZ} >${ETCDIR}/TZ

# remove the default 'rtc -c', 'rtc -s' and 'daylight' jobs from the crontab
crontab -l |sed -e '/rtc\ -c/d' -e '/daylight/d' -e '/rtc\ -s/d' |crontab -

# executing the time protocol every boot to set correct time during boot up process
/usr/sbin/sntp -r -P no pool.ntp.org 1>>${LOGFILE} 2>&1 &

I could put in the adjtimex call in fun_plug.local, but since time is set by NTP every hour I do not see a reason to do so...

Last edited by faethon (2009-04-21 10:04:55)

Offline

 

#7 2009-04-23 06:14:52

jesbo
Member
From: Falls Church, VA
Registered: 2008-08-28
Posts: 101

Re: timeproblem

I do something very similar in my fun_plug.  I add a job to crontab to run ntpdate every 6 hours.  THe following code in my fun_plug seems to work well for me.


Code:

        # remove rtc and daylight cron jobs
        /bin/crontab -l | /ffp/bin/grep -vw '/usr/sbin/daylight' | /ffp/bin/grep -vw '/usr/sbin/rtc' | crontab -

        # Install internet time sync job

        CRONTEXT=/mnt/HD_a2/crontab.txt

        /bin/crontab -l > $CRONTEXT
        /bin/echo "00 */6 * * * /ffp/bin/ntpdate us.pool.ntp.org  >>/ffp/log/ntpd.log 2>&1" >> $CRONTEXT
        /bin/crontab $CRONTEXT
        /bin/rm $CRONTEXT

        echo "Setting current date/time using ntpdate..."
        /ffp/bin/ntpdate us.pool.ntp.org  >/ffp/log/ntpd.log 2>&1

DNS-323 (H/W ver. B1) |  2 x 1 TB WD Caviar Black (Raid 1) | Corsair Flash Voyager - 16 GB USB | FW 1.08 | fun_plug 0.5

Offline

 

#8 2009-05-02 05:03:04

drick
Member
From: USA
Registered: 2009-05-01
Posts: 14

Re: timeproblem

jespo,

for those of us who are just getting started with fp, where would i put that script and how do i invoke it? i just installed funplug today, so forgive me if this is a dumb question.

Last edited by drick (2009-05-02 05:03:26)

Offline

 

#9 2009-05-02 20:34:20

luusac
Member
Registered: 2008-04-29
Posts: 360

Re: timeproblem

put it where you like :-)

when the dns-323 boots it runs a file called fun_plug in the root of Volume_1 if it finds it.  You could put a command in there to call your crontab script, or you could install ffp and put the script in the /ffp/start directory (providing it has execute permissions it will run on boot), or your fun_plug could contain the commands itself.

manual invocation would be something like

/mnt/HD_a2/pathtoscript/scriptname.sh
or
sh /mnt/HD_a2/pathtoscript/scriptname.sh
or
sh ./scriptname.sh

etc

Offline

 

#10 2009-05-07 10:51:18

cliaz
Member
From: Melbourne, Australia
Registered: 2008-11-10
Posts: 55
Website

Re: timeproblem

When is fun_plug.local meant to run, on startup?

This is my ffp/etc/examples/fun_plug.local

#!/ffp/bin/sh

PATH=/ffp/sbin:/ffp/bin
BINDIR=/ffp/bin
LOGFILE=/mnt/HD_a2/ffp.log
ETCDIR=/etc

# Adjust clock speed to reduce drift
# See 'adjtimex -h' for available options.
# 9965 works for my DNS-323, ymmv.
# adjtimex -t 9965


# Set local timezone
# For a list of timezone strings see:
# http://www.nas-tweaks.net/CH3SNAS:Tutor … ne_Strings

# Europe/Berlin
# echo 'CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00' >/etc/TZ

# Australia - Melbourne, Camberra, Sydney
TZ=AEST-10AEDT-11,M10.5.0/02:00:00,M4.1.0/03:00:00
export TZ
echo ${TZ} >${ETCDIR}/TZ

# This removes firmware cronjobs that interfere with ntpd.
# crontab -l | grep -vw '/usr/sbin/daylight' | grep -vw '/usr/sbin/rtc' | crontab -
crontab -l |sed -e '/rtc\ -c/d' -e '/daylight/d' -e '/rtc\ -s/d' | crontab -

# executing the time protocol every boot to set correct time during boot up process
/usr/sbin/sntp -r -P no au.pool.ntp/org 1>>${LOGFILE} 2>&1 &

# Clear root password for convenient login (won't work with ssh)
#usermod -p '' root


# You might want to ensure that sshd is started.
#chmod a+x /ffp/start/sshd.sh

and after rebooting, the cron jobs aren't removed, nor is the TZ file edited, which is leading me to assume the fun_plug.local isn't running.
I can put it in a script and run it on start instead, but am tryign to follow Faethon's example.

cheers,
- Klaus

Offline

 

#11 2009-05-07 10:54:24

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: timeproblem

/ffp/etc/examples/fun_plug.local is never run, it's an _example_ showing common things you might want to do. /ffp/etc/fun_plug.local is run before the scripts in /ffp/start (as can been seen in the main fun_plug script).

Offline

 

#12 2009-05-07 16:45:58

cliaz
Member
From: Melbourne, Australia
Registered: 2008-11-10
Posts: 55
Website

Re: timeproblem

wow, retard moment there, editing the wrong file.

cheers again fonz,
- Klaus

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB