#!/usr/bin/env python2.7
"""Starts an instance of a Durus extended server using
the xdserver backend.

"""
import os
from xdserver import make_server

if __name__ == '__main__':

    root = os.environ['XDSERVER_ROOTDIR']
    host = '127.0.0.1'
    port = 22972
    pid = make_server(root, host, port)
    try:
        print 'Starting Durus Extended Server on durus://%s:%d' % (host, port)
        pid.run()
    except (KeyboardInterrupt, SystemExit):
        print 
        print "Stopping server gracefully."
        pid.stop()

