Skip to content

Instantly share code, notes, and snippets.

@auzwang
Last active August 29, 2015 14:11
Show Gist options
  • Save auzwang/d22efbd949e6709ee981 to your computer and use it in GitHub Desktop.
Save auzwang/d22efbd949e6709ee981 to your computer and use it in GitHub Desktop.
function hosts() {
if [ "$1" = "open" ]; then
open /c/windows/system32/drivers/etc/hosts;
return;
fi
if [ -z "$1" ]; then
echo "cat /c/windows/system32/drivers/etc/hosts";
cat /c/windows/system32/drivers/etc/hosts;
return;
else
cat /c/windows/system32/drivers/etc/hosts | sed '/rtsky/Id' | sed '/tmcsky/Id'| sed '/WEBSERVER/Id' \
| sed '/DBSERVER/Id'| sed '/AGENT/Id' | sed '/RPF/Id' | sed '/LM-DC/Id' \
> /c/windows/system32/drivers/etc/hosts;
echo "cleaned up";
if [ "$1" = "docview" ]; then
echo "setting doview hosts";
echo "192.168.45.47 lm-dc1.lm.local
192.168.45.48 webserver01
192.168.45.49 dbserver01
192.168.45.50 rpf01" >> /c/windows/system32/drivers/etc/hosts;
fi
if [ "$1" = "84dev" ]; then
echo "setting 84dev hosts";
echo "192.168.45.242 rtsky.dev.tech.local
192.168.46.48 tmcsky.dev.tech.local
192.168.46.41 DBSERVER01
192.168.46.42 DBSERVER02
192.168.46.37 AGENT01
192.168.44.221 AGENT02
192.168.46.39 RPF01
192.168.45.209 LM-DC1" >> /c/windows/system32/drivers/etc/hosts;
fi
if [ "$1" = "842qa" ]; then
echo "setting 842qa hosts";
echo "192.168.45.18 rtsky.dev.tech.local
192.168.46.201 tmcsky.dev.tech.local
192.168.46.188 DBSERVER01
192.168.46.189 DBSERVER02
192.168.46.182 AGENT01
192.168.46.183 AGENT02
192.168.46.184 RPF01
192.168.45.16 LM-DC1 #Domain controller" >> /c/windows/system32/drivers/etc/hosts;
fi
if [ "$1" = "85qa" ]; then
echo "setting 85qa hosts";
echo "192.168.46.221 rtsky.dev.tech.local
192.168.47.4 tmcsky.dev.tech.local
192.168.46.205 DBSERVER01
192.168.46.206 DBSERVER02
192.168.46.203 AGENT01
192.168.46.204 AGENT02
192.168.46.223 RPF01
192.168.46.207 LM-DC1 #Domain controller" >> /c/windows/system32/drivers/etc/hosts;
fi
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment