def write_get_hk_script(fn, hostname, port):
    script = ('#!/bin/bash\nnc -w 1 %s %d\n' % (hostname, port))
    f = open(fn, 'w')
    f.write(script)
    f.close()
    st = os.stat(fn)
    os.chmod(fn, (st.st_mode | stat.S_IXUSR))
def write_get_hk_script(fn, hostname, port):
    script = ('#!/bin/bash\nnc -w 1 %s %d\n' % (hostname, port))
    f = open(fn, 'w')
    f.write(script)
    f.close()
    st = os.stat(fn)
    os.chmod(fn, (st.st_mode | stat.S_IXUSR))