Skip to content

Instantly share code, notes, and snippets.

@ekohl
Created February 17, 2010 16:01
Show Gist options
  • Save ekohl/306743 to your computer and use it in GitHub Desktop.
Save ekohl/306743 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
if len(sys.argv) != 2:
print "Usage: %s fqdn" % sys.argv[0]
sys.exit(1)
fqdn = sys.argv[1]
split = fqdn.split(".")
domain = ".".join(split[-2:])
try:
subdomain = split[-3]
except:
subdomain = '_'
print "/var/www/%s/%s/%s" % (domain, subdomain, fqdn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment