diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-05-22 14:35:25 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-05-22 14:35:25 -0700 |
commit | 6f8e87ec63dcf5d79f4f9b46fcb193d71f791867 (patch) | |
tree | c50616a3e8b7bfd9adcc9fd2e7c03dc0c94813db /templates/system | |
parent | 698795932eeba7dec305433451fce51898e1e3d6 (diff) | |
download | vyatta-cfg-quagga-6f8e87ec63dcf5d79f4f9b46fcb193d71f791867.tar.gz vyatta-cfg-quagga-6f8e87ec63dcf5d79f4f9b46fcb193d71f791867.zip |
Fix ntp.conf management
Had incorrect grep expressions, and don't need to use sudo
unless changing values.
Diffstat (limited to 'templates/system')
-rw-r--r-- | templates/system/ntp-server/node.def | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/templates/system/ntp-server/node.def b/templates/system/ntp-server/node.def index 21961951..f1318b28 100644 --- a/templates/system/ntp-server/node.def +++ b/templates/system/ntp-server/node.def @@ -1,18 +1,15 @@ multi: type: txt help: Set name or IP address of Network Time Protocol (NTP) server -update: if ! grep -q '^server. *$VAR(@)\$' /etc/ntp.conf +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 - sed -i '/server $VAR(@)/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" +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 |