summaryrefslogtreecommitdiff
path: root/templates/system/ntp-server/node.def
blob: f1318b28b61451c0287c6c0f1405601534d6de25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
       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
	fi