From 5296d938dddf85d50d1b61dfb628a74905f778e8 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 27 May 2009 09:35:14 -0700 Subject: 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 --- templates/system/ntp-server/node.def | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'templates') 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 -- cgit v1.2.3