forked from f1linux/pi-ap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
timedate.sh
executable file
·45 lines (30 loc) · 1.59 KB
/
timedate.sh
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
#set -x
# pi-ap: These scripts configure a Raspberry Pi into a wireless Access Point
# Source: https://github.com/f1linux/pi-ap
# Version: 01.10.02
# License: GPL 3.0
# Script Author: Terrence Houlahan Linux & Network Engineer
# Contact: [email protected]
# Linkedin: www.linkedin.com/in/terrencehoulahan
# Do not edit below sources
source "${BASH_SOURCE%/*}/variables.sh"
source "${BASH_SOURCE%/*}/functions.sh"
# Set systemd-timesyncd to start on boot if it is not already:
if [[ $(systemctl list-unit-files|grep systemd-timesyncd.service|awk '{print $2}') = 'enabled' ]]; then
timedatectl set-ntp true
fi
sed -i 's/#NTP=/NTP=0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org/' /etc/systemd/timesyncd.conf
sed -i 's/#FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org/FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org/' /etc/systemd/timesyncd.conf
sed -i 's/#RootDistanceMaxSec=5/RootDistanceMaxSec=5/' /etc/systemd/timesyncd.conf
sed -i 's/#PollIntervalMinSec=32/PollIntervalMinSec=32/' /etc/systemd/timesyncd.conf
sed -i 's/#PollIntervalMaxSec=2048/PollIntervalMaxSec=2048/' /etc/systemd/timesyncd.conf
# Re-read config with changes and restart systemd-timesyncd:
systemctl daemon-reload
systemctl restart systemd-timesyncd.service
echo 'Output of *timedatectl status* Follows:'
echo
timedatectl status
echo
echo "$(tput setaf 6)Validate above time against your computer clock to ensure it approximates current time in your geography$(tput sgr 0)"
echo