-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaws-ubuntu2204-init.sh
More file actions
46 lines (30 loc) · 1.15 KB
/
Copy pathaws-ubuntu2204-init.sh
File metadata and controls
46 lines (30 loc) · 1.15 KB
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
46
#/bin/bash
set -e
echo "=================================================="
echo "========== init update ==========================="
echo "=================================================="
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
echo "=================================================="
echo "========== download file ========================="
echo "=================================================="
set -x
curl https://raw.githubusercontent.com/SecondDim/script/main/.bash_aliases > ~/.bash_aliases
set +x
echo "=================================================="
echo "========== set aws ntp ==========================="
echo "=================================================="
# set aws ntp
sudo apt install chrony
set -x
match='# See http:\/\/www.pool.ntp.org\/join.html for more information.'
insert='server 169.254.169.123 prefer iburst minpoll 4 maxpoll 4'
file='/etc/chrony/chrony.conf'
if ! grep -q "$insert" $file; then
sudo sed -i "s/$match/$match\n$insert/" $file
sudo /etc/init.d/chrony restart
sleep 1
fi
set +x
chronyc sources -v
chronyc tracking
echo "========== [script done] ========================="