Skip to content

Instantly share code, notes, and snippets.

@pablofmorales-olx
Created January 11, 2013 14:31
Show Gist options
  • Save pablofmorales-olx/4511058 to your computer and use it in GitHub Desktop.
Save pablofmorales-olx/4511058 to your computer and use it in GitHub Desktop.
#!/bin/sh
echo "Changing the DNS to " $1
if [ "$1" == 'local' ]; then
DNS='10.0.0.203'
elif [ "$1" == 'prod' ]; then
DNS='10.0.0.200'
elif [ "$1" == 'qa2' ]; then
DNS='10.0.0.202'
elif [ "$1" == 'qa1' ]; then
DNS='10.0.0.201'
elif [ "$1" == 'dev' ]; then
DNS='10.0.5.180'
else
DNS='8.8.8.8'
fi
if [ "$1" == "local" ]; then
cp /etc/hosts.local /etc/hosts
else
cp /etc/hosts.default /etc/hosts
fi
echo "nameserver " $DNS > /etc/resolv.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment