Skip to content

Instantly share code, notes, and snippets.

@andrix
Created December 2, 2011 16:54
Show Gist options
  • Select an option

  • Save andrix/1423960 to your computer and use it in GitHub Desktop.

Select an option

Save andrix/1423960 to your computer and use it in GitHub Desktop.

Revisions

  1. andrix renamed this gist Dec 2, 2011. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. andrix created this gist Dec 2, 2011.
    15 changes: 15 additions & 0 deletions isup
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/usr/bin/env python
    import re
    import sys
    from urllib import urlopen

    def isup(domain):
    resp = urlopen("http://www.isup.me/%s" % domain).read()
    return "%s: %s" % (domain, "UP" if re.search("It's just you.", resp,
    re.DOTALL) else "DOWN")

    if __name__ == '__main__':
    if len(sys.argv) > 1:
    print "\n".join(isup(d) for d in sys.argv[1:])
    else:
    print "usage: %s domain1 [domain2 .. domainN]" % sys.argv[0]