You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
506 B
18 lines
506 B
2 years ago
|
# don't resolve container names to *real* CSC machines
|
||
|
sed -E '/^(domain|search)[[:space:]]+csclub.uwaterloo.ca/d' /etc/resolv.conf > /tmp/resolv.conf
|
||
|
cp /tmp/resolv.conf /etc/resolv.conf
|
||
|
rm /tmp/resolv.conf
|
||
|
|
||
|
get_ip_addr() {
|
||
|
getent hosts $1 | cut -d' ' -f1
|
||
|
}
|
||
|
|
||
|
add_fqdn_to_hosts() {
|
||
|
ip_addr=$1
|
||
|
hostname=$2
|
||
|
sed -E "/${ip_addr}.*\\b${hostname}\\b/d" /etc/hosts > /tmp/hosts
|
||
|
cp /tmp/hosts /etc/hosts
|
||
|
rm /tmp/hosts
|
||
|
echo "$ip_addr $hostname.csclub.internal $hostname" >> /etc/hosts
|
||
|
}
|