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 2011-10-30 18:58:03

ottsm
Member
Registered: 2010-12-23
Posts: 44

Time keeps getting out of sync

I have both a DNS323 and now a new DNS325.  On the DNS323 I don't remember having time sync issues and I'm at least up to 1.09 on the firmware.  I just installed Fun_Plug on the DNS325 and have almost everything working the way I want it except the clock is off.

I've tried changing to different NTP servers using the standard dlink system management menu.  Some servers force me off by one hour, others cause a 5 minute lag.  While I found one that is only off by 2 minutes.  So what going on?

Does the Fun_Plug conflict with the built in firmware? 
stime is running in crontab.

30 2 * * * /usr/sbin/stime&

so everyday at 2:30 in the morning stime sets the clock.

This problem is really frustrating, anyone know how to fix it?

Offline

 

#2 2011-10-30 19:57:00

ottsm
Member
Registered: 2010-12-23
Posts: 44

Re: Time keeps getting out of sync

Noticed if I run stime in PuTTy it actually gets the minutes correct by is off by one hour.  But it is using ntp1.dlink.com as the time server, however, that is not what server is configured in the system manager.

Offline

 

#3 2011-10-30 21:15:13

ottsm
Member
Registered: 2010-12-23
Posts: 44

Re: Time keeps getting out of sync

I noticed when I typed in the "date" command that the UTC was off by one hour.  I finally got into the web based system manager and set the time zone to GMT or basically UTC.  At least the NTP server doesn't screw up the time by one hour.  I tried removing the "stime" from crontab but it got placed back in crontab when I rebooted.

Offline

 

#4 2011-10-30 22:25:58

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: Time keeps getting out of sync

Place something like this in fun_plug.local

Code:

# Fix timezone information.
echo "`date` Setting Time Zone information in /etc/TZ to EST5EDT,M3.2.0,M11.1.0"
echo "EST5EDT,M3.2.0,M11.1.0" > /etc/TZ

Create a script to remove the date and stime crontab entries and add something like this one

Code:

0  */8 * * * /ffp/bin/ntpd -g -q -c /ffp/etc/ntpd.conf >/dev/null

partial script

Code:

CRONTXT=/tmp/crontab.txt
CRONCONF=/ffp/etc/addcron.conf
CRONFILE=/ffp/etc/crontab_default.txt
HOST=`/ffp/bin/hostname`

echo "`date` Running crontab update script [$0] on ${HOST}"

# Check for saved default cron jobs
if [ ! -f ${CRONFILE} ]; then
  echo "`date` Saving default crontab entries to [${CRONFILE}]"
  /bin/crontab -l >${CRONFILE}
  echo "`date` Removing timezone related entries"
  /ffp/bin/sed -i "/daylight/d" ${CRONFILE}
  /ffp/bin/sed -i "/rtc/d" ${CRONFILE}
  /ffp/bin/sed -i "/stime/d" ${CRONFILE}
fi

Code:

# Load the default crontab entries
if [ -f ${CRONFILE} ]; then
  echo "`date` Found base crontab entries in [${CRONFILE}]"
  cat ${CRONFILE} > ${CRONTXT}
else
  echo "`date` Something is wrong. Can't find [${CRONFILE}]"
  echo "`date` Using existing crontab entries as a base"
  /bin/crontab -l > ${CRONTXT}
fi

Mine is out .3 seconds every 8 hours.

Last edited by FunFiler (2011-10-30 22:40:35)


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#5 2011-10-30 22:42:14

ottsm
Member
Registered: 2010-12-23
Posts: 44

Re: Time keeps getting out of sync

I had hopes to avoid this, I've been reading up on some previous threads like this.  I would have thought Dlink would have fixed some of these issues, or is it the Fun_Plug causing the issues?  Guess I'm going to have to bit the bullet and do what you have listed above.

Thanks for taking the time to list all detail above, my Linux skills and overall programming skills are getting dated.

Offline

 

#6 2011-10-30 23:21:10

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: Time keeps getting out of sync

Its a DLink problem.


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#7 2011-10-31 06:01:08

ottsm
Member
Registered: 2010-12-23
Posts: 44

Re: Time keeps getting out of sync

Ok, I did the following so far;

First I copied the example files over for "fun_plug.local" & "ntp.conf"

Under "fun_plug.local" file I did the following;

   # USA Eastern Time Zone
   echo 'EST5EDT' >/etc/TZ

   # Remove stime from cronjobs
   crontab -l | grep -vw stime | crontab -

Just a note, the DNS325 only has stime running, it does not have daylight or rtc running.

I added the "us" versus "de" servers to "ntp.conf"

I made ntpd.sh executable and didn't change any of the code (even though it's missing stime from it's list, seems redundant).

It does not show up as a cron job because it's running all the time, don't know if this is bad or good.  I could see having it listed as a cron job would be a good place to find it rather then looking in the process list.  Plus it's running all the time, cron could control how often it runs.

I may go back and redo it using a cron job.


See the following link for more details;

http://nas-tweaks.net/77/fixing-the-ntp … ne_Strings




Only strange thing is, under the dlink manager it still shows a different NTP sever and they don't give you a way to shut it off.  I'm not sure if it's going to cause an issue.

Offline

 

#8 2011-10-31 12:02:37

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: Time keeps getting out of sync

Use the extended TZ setting to get a proper roll for DST/EST. Otherwise it will use the "old" dates. NTP server doesn't matter if you kill the jobs that use it.


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#9 2011-11-01 03:49:06

ottsm
Member
Registered: 2010-12-23
Posts: 44

Re: Time keeps getting out of sync

Thanks, I now have the extended time zone settings.  I still have some issue I'm trying to figure out.  I have rsync setup to run in crontab but for some reason it didn't run last night according to the log file I have setup.  I'll see if it runs tonight.  Also noticed the drift just shows 0.000, either I'm lucky or it's not updating correctly.  I'm reading about the "-x" setting for NTPD.  Might need to set this.


  Rsync is the entire reason I'm doing this.  Dlink's built-in backup system won't automatically delete files on the 2nd hard drive if they were deleted on the 1st drive.  It seems they finally got the file dates correct on the new DNS325, the DNS323 would always use the current date on the backup drive which is no good if you are using the file date to keep track of files (such as when pictures were taken, etc).

Offline

 

#10 2011-11-01 05:09:01

ottsm
Member
Registered: 2010-12-23
Posts: 44

Re: Time keeps getting out of sync

Ok, I see why crontab didn't run rsync, crontab is working under UTC time versus the EDT time.  It finally did run today but at 22:05:00 versus 2:05:00 in the morning.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB