NTP fails synchronization with server at startup

Phil Meyer pmeyer at themeyerfarm.com
Thu Dec 6 21:45:18 UTC 2007


Paul Smith wrote:
> Dear All,
>
> I have NTP configured to synchronize with a server at startup, but it
> always fails that as reported by F8 during the booting.
> Notwithstanding:
>
> # /sbin/service ntpd restart
> Shutting down ntpd:                                        [  OK  ]
> ntpd: Synchronizing with time server:                      [  OK  ]
> Starting ntpd:                                             [  OK  ]
> #
>
> Any ideas?
>
> Thanks in advance,
>
> Paul
>
>   

I have read through the thread, but I don't see mention of using 
NetworkManager to start ntpd for you.

NetworkManager, as has been discussed, was designed to start interfaces 
upon user login. This is especially useful for laptops and systems that 
get moved around alot and have more than one user account. Thus, users 
do not need to allow access to private networks that other users do not 
need.

What has not been discussed, is NetworkManagers ability to start any/all 
network based services when a user logs in.

This is somewhat similar to domain lofins, if that helps explain it. 
Basically, a script, or group of scripts can/will be run when a user 
logs in.

These can range from:
service start ntpd
to
mount server:/home/myhome/data /home/myhome/data

These scripts can run as any user, since they are executed as root in 
the first place.

To resolve the OPs issue, create two simple scripts. One for startup, 
one for stopping ntpd. You can also specify these by interface. For 
instance: eth0=wired and eth1=wireless. Perhaps I only want nptd running 
when on the wired connection because I use the wireless mostly in an 
ad-hoc network, or for wardriving.

Lets assume for these examples that we want ntpd to start every time 
NetworManager brings up eth0, and turn it off whenever NetworkManager 
turns off eth0.

Add this script (ore make one like it to suit your needs) to the 
/etc/NetworkManager/dispatcher.d/ directory.

#!/bin/sh

# scripts in the /etc/NetworkManager/dispatcher.d/ directory
# are called alphabetically and are passed two parameters:
# $1 is the interface name, and $2 is “up” or “down”

if [ "$1" = "eth0" ]
then
if [ "$2" = "up" ]
then
/sbin/service ntpd start
fi
if [ "$2" = "down" ]
then
/sbin/service ntpd stop
fi
fi

I call it ntpd.
# chmod 755 ntpd

Now pull the wired plug, and then plug it back in. ntpd should be running.

It will be most useful using this method to:

# /sbin/chkconfig ntpd off

All services you want NetworkManager to 'manage' need to be set to off 
mode based on run level.

Good Luck!






More information about the fedora-list mailing list