-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2.sh
More file actions
50 lines (44 loc) · 1.39 KB
/
Copy path2.sh
File metadata and controls
50 lines (44 loc) · 1.39 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
47
48
49
50
#!/bin/bash
# Đường dẫn của tệp cấu hình resolved.conf
resolved_conf_path="/etc/systemd/resolved.conf"
# Kiểm tra xem tệp resolved.conf đã tồn tại chưa
if [ -e "$resolved_conf_path" ]; then
# Xóa tệp resolved.conf nếu đã tồn tại
sudo rm "$resolved_conf_path"
echo "Đã xóa tệp $resolved_conf_path."
fi
# Nội dung mẫu của resolved.conf
resolved_conf_content="
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details
[Resolve]
#DNS=
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
#Cache=no-negative
#DNSStubListener=yes
#ReadEtcHosts=yes
"
# Ghi nội dung mẫu vào tệp resolved.conf mới
echo "$resolved_conf_content" | sudo tee "$resolved_conf_path" > /dev/null
# Kiểm tra xem việc ghi đã thành công chưa
if [ $? -eq 0 ]; then
echo "Đã tạo tệp $resolved_conf_path mới thành công."
else
echo "Có lỗi xảy ra khi tạo tệp $resolved_conf_path mới."
exit 1
fi