Skip to content

Instantly share code, notes, and snippets.

@uggedal
Created April 13, 2011 20:39
Show Gist options
  • Select an option

  • Save uggedal/918358 to your computer and use it in GitHub Desktop.

Select an option

Save uggedal/918358 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# <udf name="fqdn" label="Fully qualified domain name" />
PUBLIC_IP_ADDRESS=`ifconfig eth0 | awk -F':' '/inet addr/{split($2,_," ");print _[1]}'`
echo $FQDN > /etc/hostname && hostname -F /etc/hostname
echo $PUBLIC_IP_ADDRESS `hostname` `hostname -s` >> /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment