summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-05-27 09:35:14 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-05-27 09:35:14 -0700
commit5296d938dddf85d50d1b61dfb628a74905f778e8 (patch)
treebc22b9e3c844e0d3a699e99dc2e391e1b16476dd
parent1480cbfd0056d209aa872216938ec1b9226186ed (diff)
downloadvyatta-cfg-system-5296d938dddf85d50d1b61dfb628a74905f778e8.tar.gz
vyatta-cfg-system-5296d938dddf85d50d1b61dfb628a74905f778e8.zip
NTP management version 3
1. Don't start NTP server at boot (network not configed yet) 2. Start NTP as needed based on vyatta config
-rw-r--r--debian/vyatta-cfg-system.postinst.in5
-rw-r--r--templates/system/ntp-server/node.def24
2 files changed, 14 insertions, 15 deletions
diff --git a/debian/vyatta-cfg-system.postinst.in b/debian/vyatta-cfg-system.postinst.in
index 57f4b043..ec159432 100644
--- a/debian/vyatta-cfg-system.postinst.in
+++ b/debian/vyatta-cfg-system.postinst.in
@@ -7,13 +7,10 @@ bindir=@bindir@
sbindir=@sbindir@
# remove init of daemons that we start/stop
-for init in ssh snmpd openhpid vyatta-keepalived ipvsadm dnsmasq ddclient; do
+for init in ntp ssh snmpd openhpid vyatta-keepalived ipvsadm dnsmasq ddclient; do
update-rc.d -f ${init} remove >/dev/null
done
-# for upgrade make sure ntp is run during boot
-update-rc.d ntp defaults
-
# remove extra call to clock setup only need one. this speeds up boot
# Mystery: why does Debian do it twice?
if [ -L /etc/rcS.d/S08hwclockfirst.sh -a -L /etc/rcS.d/S11hwclock.sh ]; then
diff --git a/templates/system/ntp-server/node.def b/templates/system/ntp-server/node.def
index f1318b28..c8e3a9f2 100644
--- a/templates/system/ntp-server/node.def
+++ b/templates/system/ntp-server/node.def
@@ -1,15 +1,17 @@
multi:
type: txt
help: Set name or IP address of Network Time Protocol (NTP) server
-update: if ! grep -q '^server $VAR(@) ' /etc/ntp.conf
- then sudo sh -c \
- "echo \"server $VAR(@) iburst\" >> /etc/ntp.conf;
- /usr/sbin/invoke-rc.d ntp restart"
- fi
-delete: if grep -q '^server.*$VAR(@) ' /etc/ntp.conf
- then sudo sed -i '/^server $VAR(@) /d' /etc/ntp.conf
- if grep -q '^server ' /etc/ntp.conf
- then sudo /usr/sbin/invoke-rc.d ntp restart
- else sudo /usr/sbin/invoke-rc.d ntp stop
- fi
+create: if ! grep -q '^server $VAR(@) ' /etc/ntp.conf
+ then sudo sh -c \
+ "echo \"server $VAR(@) iburst\" >> /etc/ntp.conf; \
+ /usr/sbin/invoke-rc.d ntp restart"
+ elif ! /usr/sbin/invoke-rc.d ntp status
+ then sudo /usr/sbin/invoke-rc.d ntp start
fi
+delete: if grep -q '^server $VAR(@) ' /etc/ntp.conf
+ then sudo sed -i '/^server $VAR(@) /d' /etc/ntp.conf
+ if grep -q '^server ' /etc/ntp.conf
+ then sudo /usr/sbin/invoke-rc.d ntp restart
+ else sudo /usr/sbin/invoke-rc.d ntp stop
+ fi
+ fi