File: ntpdate-debian

package info (click to toggle)
ntp 1%3A4.2.8p10%2Bdfsg-3%2Bdeb9u2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 32,104 kB
  • sloc: ansic: 237,718; sh: 6,873; makefile: 3,381; perl: 2,645; python: 1,473; yacc: 1,413; ruby: 816; awk: 417; sed: 47; asm: 37
file content (25 lines) | stat: -rw-r--r-- 534 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

set -e

if [ -r /etc/default/ntpdate ]; then
	. /etc/default/ntpdate
fi

if [ "$NTPDATE_USE_NTP_CONF" = yes ]; then
	for f in /etc/ntp.conf /etc/openntpd/ntpd.conf; do
		if [ -r "$f" ]; then
			file=$f
			break
		fi
	done
	if [ -n "$file" ]; then
		NTPSERVERS=$(sed -rne 's/^(servers?|peer|pool)[[:space:]]+(-[46][[:space:]]+)?([-_.:[:alnum:]]+).*$/\3/p' "$file" | grep -v '^127\.127\.') || [ $? -le 1 ]
	fi
fi

if [ -r /run/ntpdate.dhcp ]; then
	. /run/ntpdate.dhcp
fi

exec /usr/sbin/ntpdate $NTPOPTIONS "$@" $NTPSERVERS