Skip to content

Instantly share code, notes, and snippets.

@revans
Created February 11, 2011 16:50
Show Gist options
  • Save revans/822634 to your computer and use it in GitHub Desktop.
Save revans/822634 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ "$1" == "add" ]]; then
IPADDR=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`
HOSTNAME=`hostname`
sed -i "s/127.0.0.1 localhost.localdomain localhost/127.0.0.1 localhost.localdomain localhost\n$IPADDR $HOSTNAME.clientstagingapp.com $HOSTNAME\n/g" /etc/hosts
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment