socket_connection_attempt.py.in 365 Bytes
#!%(python_path)s
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
import socket
import sys

hostname = "%(hostname)s"
port = %(port)s

try:
  s = socket.create_connection((hostname, port))
  s.close()
except (socket.error, socket.timeout):
  sys.stderr.write("%(port)s on %(hostname)s isn't listening\n")
  sys.exit(127)