From be79ca9ff0b67565870a18fa2ddadd09deb934a1 Mon Sep 17 00:00:00 2001
From: An-Cheng Huang <ancheng@vyatta.com>
Date: Wed, 17 Oct 2007 18:45:17 -0700
Subject: use the default init scripts from ntp and sysklogd

---
 templates/system/ntp-server/node.def | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

(limited to 'templates/system/ntp-server/node.def')

diff --git a/templates/system/ntp-server/node.def b/templates/system/ntp-server/node.def
index 9f828e1..230dd31 100644
--- a/templates/system/ntp-server/node.def
+++ b/templates/system/ntp-server/node.def
@@ -1,16 +1,17 @@
 multi:
 type: txt
-help: "IP address of NTP server"
-# should help be "domain name" instead of "ip address", or change type to ipv4?
-create: "sh -c \"touch /etc/ntp/ntp.conf && \
-if ! grep -q 'server.*$(@)' /etc/ntp/ntp.conf; then \
-echo \\\"server $(@)\\\" >> /etc/ntp/ntp.conf && \
-/opt/vyatta/sbin/ntpd.init restart; fi\" "
-update: "sh -c \"touch /etc/ntp/ntp.conf && \
-if ! grep -q 'server.*$(@)' /etc/ntp/ntp.conf; then \
-echo \\\"server $(@)\\\" >> /etc/ntp/ntp.conf && \
-/opt/vyatta/sbin/ntpd.init restart; fi\" "
-delete: "sh -c \"touch /etc/ntp/ntp.conf && \
-if grep -q 'server.*$(@)' /etc/ntp/ntp.conf; then \
-sed -i '/server $(@)/d' /etc/ntp/ntp.conf && \
-/opt/vyatta/sbin/ntpd.init restart; fi\" "
+help: "Name or IP address of NTP server"
+update: "touch /etc/ntp.conf && \
+if ! grep -q 'server.*$(@)' /etc/ntp.conf; then \
+  echo \"server $(@)\" >> /etc/ntp.conf && \
+  /usr/sbin/invoke-rc.d ntp restart; \
+fi"
+delete: "touch /etc/ntp.conf && \
+if grep -q 'server.*$(@)' /etc/ntp.conf; then \
+  sed -i '/server $(@)/d' /etc/ntp.conf && \
+  if grep -q '^server ' /etc/ntp.conf; then \
+    /usr/sbin/invoke-rc.d ntp restart; \
+  else \
+    /usr/sbin/invoke-rc.d ntp stop; \
+  fi; \
+fi"
-- 
cgit v1.2.3

