Find the answer to your Linux question:
Results 1 to 3 of 3
Hi NG, I try to sync my linux machine with a NTP server. The time has to be written to hardware clock and all has to work at runtime - ...
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Posts
    2

    problem with time sync

    Hi NG,

    I try to sync my linux machine with a NTP server. The time has to be written to hardware clock and all has to work at runtime - my machine will never shutdown - only way to reboot is a reset/watchdog/power cycle.

    I try to run a startup script:

    --snip--
    loopC=0
    until /usr/sbin/rcntp ntptimeset > /dev/null; do
    echo "retrying sync with timeserver, result was $?"
    sleep 1
    loopC=$((loopC+1));
    if [ $loopC -gt 4 ]; then
    echo "giving up"
    break;
    fi
    done

    /sbin/hwclock --systohc
    date
    --snip--

    but it isn't working.

    When I reset After this script, the hardware clock doesn't show correct time/date. running the commands manually at console, seems to work. What could be by fault?

    thanks in advice

    Thomas

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    When you install ntp, it should also enable the ntpd daemon process when you boot. If you are fastbooting an embedded systems board, then you might need to start up ntpd yourself (I just had to do this on an ARM9 board myself). Once I did that, it keeps my hardware clock nicely up-to-date as soon as it connects with the ntp server. Usually takes a couple of seconds at most. Once you do that, then you can setup a script to sync the hardware clock every so often. As to why your script isn't working, I really can't say.

    BTW, I assume that /usr/sbin/rcntp would be equivalent to ntpdate? Also, what distribution+version+kernel are you running?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Mar 2010
    Posts
    2
    Thank you for your quick response.

    I'm using SUSE 11.1 and a self configured kernel2.6.27.7

    rcntpd status says "unused" even if i run rcntpd start before.

    There still must be something wrong...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...