mirror of
https://github.com/thelittlerocket/pve.git
synced 2025-03-03 17:27:17 +08:00
Create check-dns.sh
This commit is contained in:
parent
8b41a0da60
commit
39bf505a79
1 changed files with 14 additions and 0 deletions
14
check-dns.sh
Normal file
14
check-dns.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
#from https://github.com/spiritLHLS/pve
|
||||
|
||||
DNS_SERVER="8.8.8.8"
|
||||
RESOLV_CONF="/etc/resolv.conf"
|
||||
|
||||
grep -q "^nameserver ${DNS_SERVER}$" ${RESOLV_CONF}
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "DNS server ${DNS_SERVER} already exists in ${RESOLV_CONF}."
|
||||
else
|
||||
echo "Adding DNS server ${DNS_SERVER} to ${RESOLV_CONF}..."
|
||||
echo "nameserver ${DNS_SERVER}" >> ${RESOLV_CONF}
|
||||
fi
|
Loading…
Reference in a new issue