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.
35 lines
803 B
35 lines
803 B
# 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
|
|
}
|
|
|
|
sync_with() {
|
|
host=$1
|
|
port=9000
|
|
if [ $# -eq 2 ]; then
|
|
port=$2
|
|
fi
|
|
synced=false
|
|
# give it 5 minutes
|
|
for i in {1..60}; do
|
|
if nc -vz $host $port ; then
|
|
synced=true
|
|
break
|
|
fi
|
|
sleep 5
|
|
done
|
|
test $synced = true
|
|
}
|
|
|