summaryrefslogtreecommitdiff
path: root/templates/system
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-05-18 15:32:58 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-05-18 15:49:06 -0700
commitfc734a42e6a29774e47f74445e0ebc3cf376efc2 (patch)
tree8e519e39f57b84828b8dd0c39162eed12e8929af /templates/system
parent47a147ce76fa6a59157601f1199ad8deadd35943 (diff)
downloadvyatta-cfg-system-fc734a42e6a29774e47f74445e0ebc3cf376efc2.tar.gz
vyatta-cfg-system-fc734a42e6a29774e47f74445e0ebc3cf376efc2.zip
Avoid restarting NTP server if not needed
On boot if ntp.conf contains proper server, there is no need to restart ntpd.
Diffstat (limited to 'templates/system')
-rw-r--r--templates/system/ntp-server/node.def14
1 files changed, 5 insertions, 9 deletions
diff --git a/templates/system/ntp-server/node.def b/templates/system/ntp-server/node.def
index 31840936..21961951 100644
--- a/templates/system/ntp-server/node.def
+++ b/templates/system/ntp-server/node.def
@@ -1,15 +1,11 @@
multi:
type: txt
help: Set name or IP address of Network Time Protocol (NTP) server
-update:sudo sh -c \
- "if ! grep -q 'server.*$VAR(@)' /etc/ntp.conf; then
- echo \"server $VAR(@) iburst\" >> /etc/ntp.conf
- fi
- if [ $(pgrep -c ntpd) -eq 0 ]; then
- /usr/sbin/invoke-rc.d ntp start
- else
- /usr/sbin/invoke-rc.d ntp restart
- fi"
+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:sudo sh -c \
"touch /etc/ntp.conf
if grep -q 'server.*$VAR(@)' /etc/ntp.conf; then