Mattew Saltzman wrote:
The correct solution is to use NetworkManagerDispatcher(1) to start ntpd
when the connection is made.
Don't modify any system files or rc.local. Just turn ntp off at boot and
add a script to /etc/NetworkManager/dispatcher.d/ that runs "service ntpd
start" when an interface is brought up and "service ntpd stop" when it's
brought down. Instructions in the man page.
here is my solution that works -- Thanks Matthew!:
sudo mkdir -p /etc/NetworkManager/dispatcher.d
sudo vi /etc/NetworkManager/dispatcher.d/ntpd
----
#!/bin/sh
interface=$1
state=$2
case $state in
up) /sbin/service ntpd start;;
down) /sbin/service ntpd stop;;
*) ;;
esac
----
sudo chmod 755 /etc/NetworkManager/dispatcher.d/ntpd
You can see that it can also be tested for interface, so maybe you only
want to start ntpd when eth0 starts. What you see here will start and
stop ntpd on every interface change.