Re: ntpd doesn't start correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 21 June 2006 02:32, Rob Brown-Bayliss wrote:
> On 6/21/06, Ambrogio <fn050202@xxxxxxxxxxx> wrote:
> > I'm experiencing a bad behavior of ntp server.
> 
> I have had some network probnlems lately, and noticed that if the
> network is not running before NTP starts it plays up a bit.
> 
> It's not a fix, but hack as such, can you set things so that ntpd
> only starts when at home or your office?  That way you know the
> network is running first?  Perhjapse use a spare runlevel for the
> office/home and another for on the raod?

If you use NetworkManager, you can solve this problem.

The NetworkManagerDispatcher will run programs or scripts in response
to interface up/down events.  One use of this is to start (or restart)
the ntpd when the interface transitions from down -> up and to stop
the ntpd when the interface transitions from up -> down.  See
NetworkManagerDispatcher(1) for details.

Here's the script I run on on my laptop when an interface transitions
(/etc/NetworkManager/dispatcher.d/ntpd-script).  I can't remember
where I got this, but the code is simple and straightforward.  I
always have a happy ntpd as long as I have an interface up:

    #!/bin/bash
    #
    # $Id: ntpd-script,v 1.1 2006/02/18 10:52:03 root Exp $

    if [ -x /usr/bin/logger ]; then
	    LOGGER="/usr/bin/logger -s -p user.notice -t NetworkManagerDispatcher"
    else
	    LOGGER=echo
    fi

    if [ ! -x /etc/init.d/ntpd ]; then
      $LOGGER "init script /etc/init.d/ntpd missing or not executible"
      return
    fi

    if [ -n $1 ] && [ $2 == "up" ]; then

      if [ -f /var/run/ntpd.pid ]; then
	$LOGGER "ntpd is running, restart"
	/sbin/service ntpd restart
      else
	$LOGGER "ntpd is not running, start"
	/sbin/service ntpd start
      fi

    fi

    if [ -n $1 ] && [ $2 == "down" ] && [ -f /var/run/ntpd.pid ]; then
      $LOGGER "ntpd is running, stop"
      /sbin/service ntpd stop
    fi

-- 
Garry T. Williams --- +1 678 656-4579



-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux