summaryrefslogtreecommitdiff
path: root/templates/system/ntp-server/node.def
blob: e15961613995e3860202c554a8c129c0192e64f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
multi:
priority: 400
type: txt
help: Network Time Protocol (NTP) server
create: 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"
        elif ! /usr/sbin/invoke-rc.d ntp status
	then sudo /usr/sbin/invoke-rc.d ntp start
	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