LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 05-29-2008, 01:12 AM   #1
ninja master
Member
 
Registered: May 2008
Distribution: gentoo amd64 xwrt
Posts: 407

Rep: Reputation: 30
my clock is jacked up under slackware 12.1


the clock has an option to "set date and time automatically" when ever i select this it says "unable to contact time server: pool.ntp.org" it says this on a screen that is running pings to the url. my router runs a "ntpclient" that i can cron to sync so often or just once if i like. i have tryed to find ntpclient for slackware but have failed. any help/ideas are appreciated but i would like to sync the "date" command and could really care less about the visual clock.
 
Old 05-29-2008, 02:36 AM   #2
ludist
Member
 
Registered: Nov 2005
Location: Greece
Distribution: Slackware
Posts: 129

Rep: Reputation: 16
I don't know if is a better way (a deamon) you can execute:

Code:
ntpdate YourChoiceOfServer
 
Old 05-29-2008, 03:06 AM   #3
SqdnGuns
Member
 
Registered: Aug 2005
Location: Fountain Valley, CA / Thailand
Distribution: Slackware64 14.0
Posts: 981

Rep: Reputation: 88
Here is how I set it up:

Make sure /etc/rc.d/rc.ntpd is executable.

Code:
chmod +x /etc/rc.d/rc.ntpd
This is what my /etc/rc.d/rc/ntpd looks like.

Code:
#!/bin/sh
#
# start the Network Time Protocol
#
if [ ${1} = "start" ]
 then
  # set the clock from a public server
  echo "Setting clock from tock.usno.mil..."
  /usr/sbin/ntpdate -v 192.5.41.41
  sleep 2
  echo "Starting Network Time Protocol daemon..."
  /usr/sbin/ntpd -l /tmp/ntp.log
elif [ ${1} = "stop" ]
 then
  echo "Stopping Network Time Protocol daemon..."
  pid=`/bin/ps -e | /usr/bin/grep ntp |\
  /usr/bin/sed -e 's/^ *//' -e 's/ .*//'`
 if [ "${pid}" != '' ]
  then
  kill ${pid}
 fi
fi
Edit your /etc/ntp.conf and add this or your own choice.

Code:
server 192.5.41.41          # tock.usno.navy.mil
server ntp-01.caltech.edu   # Caltech border machine
server timekeeper.isi.edu   # ISI
Add this to your /etc/rc.d/rc.local

Code:
# Start the NTP daemon
#
if [ -x /etc/rc.d/rc.ntpd ]
 then
  /etc/rc.d/rc.ntpd start
fi
Start/Restart /etc/rc.d/rc.ntpd

You're all set now............not sure where I found this but it works flawlessly.
 
Old 05-29-2008, 09:32 AM   #4
ninja master
Member
 
Registered: May 2008
Distribution: gentoo amd64 xwrt
Posts: 407

Original Poster
Rep: Reputation: 30
im sorry, i fixed this issue 5 minutes after posting this but passed out before i could post whats up. openwrt has 2 ntp packages ntpd and ntpclient. where slackware has one, ntpd. i went to /etc/rc.d and issued rc.ntpd stop. this freed up the socket for ntp. i then ran ntpdate pool.ntp.org and it synced my clock as i had requested. i then restarted the rc.ntpd daemon
 
Old 05-29-2008, 01:28 PM   #5
raconteur
Member
 
Registered: Dec 2007
Location: Slightly left of center
Distribution: slackware
Posts: 276
Blog Entries: 2

Rep: Reputation: 44
Its a bit late, but this still may have value...

I call this in my rc.local and also call a silent version from cron daily. Some PC clocks drift horribly so I sync frequently on machines that need accuracy and don't have access to GPS time.

---
#!/bin/sh
# Sync the date with a time server

echo -n "Syncing the date and time to a time server..."

# kill ntpd to free the ntp port
/etc/rc.d/rc.ntpd stop >/dev/null 2>&1
sleep 1

# call ntpdate to sync the clock and update the drift files
ntpdate -u 0.us.pool.ntp.org >/dev/null 2>&1

# restart ntpd
/etc/rc.d/rc.ntpd start >/dev/null 2>&1

echo "done."
---
 
Old 09-08-2008, 10:16 PM   #6
ninja master
Member
 
Registered: May 2008
Distribution: gentoo amd64 xwrt
Posts: 407

Original Poster
Rep: Reputation: 30
i looked at my system again, as every time i format the ntpd gets screwed up. the command the daemon runs is "/usr/sbin/ntpdate -g"

i simply edit the command to run
"/usr/sbin/ntpdate -v pool.ntp.org"

and all is well =)
 
Old 01-27-2009, 11:47 PM   #7
ninja master
Member
 
Registered: May 2008
Distribution: gentoo amd64 xwrt
Posts: 407

Original Poster
Rep: Reputation: 30
from http://en.wikipedia.org/wiki/Ntpd

Code:
To manually force the time to synchronize, use:

 ntpd -q
so i am setting my ntp.conf to a localized ntp server, and i am going to add ntpd -q to my cron hourly to make it refresh hourly. i hope this fixes everything.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
That penguin jacked my ip alltaken Linux - Networking 6 04-05-2005 11:38 PM
jacked up my httpd.conf Robert0380 Linux - Software 2 06-17-2003 02:32 AM
jacked up glibc rdanda Slackware 6 04-10-2003 10:45 PM
jacked up the firewall elpresidente Linux - Networking 4 06-15-2002 07:51 PM


All times are GMT -5. The time now is 11:29 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration