#!/usr/bin/python # # Do hostname lookups in a separate thread in case # we're not connected - otherwise we hang for too long. # import os import socket import thread import threading def wakeup(): print 'WAKEUP' thread.interrupt_main() t=threading.Timer(4,wakeup) t.start() fqdn=socket.getfqdn() print 'LOOKUP:',fqdn,socket.gethostbyname(fqdn) t.cancel()