When the daemon is started write out the information which port it was using.

def get_context_file_name(pid_file):
    """When the daemon is started write out the information which port it was using."""
    root = os.path.dirname(pid_file)
    port_file = os.path.join(root, "context.json")
    return port_file