diff options
Diffstat (limited to 'templates/system/ntp-server/node.def')
-rw-r--r-- | templates/system/ntp-server/node.def | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/templates/system/ntp-server/node.def b/templates/system/ntp-server/node.def new file mode 100644 index 00000000..230dd313 --- /dev/null +++ b/templates/system/ntp-server/node.def @@ -0,0 +1,17 @@ +multi: +type: txt +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" |