diff --git a/couchpotato/runner.py b/couchpotato/runner.py index 403299a..7bf49cd 100644 --- a/couchpotato/runner.py +++ b/couchpotato/runner.py @@ -23,6 +23,7 @@ import requests from requests.packages.urllib3 import disable_warnings from tornado.httpserver import HTTPServer from tornado.web import Application, StaticFileHandler, RedirectHandler +from tornado.netutil import bind_unix_socket from couchpotato.core.softchroot import SoftChrootInitError from socket import error as SocketError import errno @@ -348,11 +349,14 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En while run_tries > 0: run_tries -= 1 try: - server.listen(config['port'], config['host']) + if config['host'].startswith('unix:'): + server.add_socket(bind_unix_socket(config['host'][5:])) + else: + server.listen(config['port'], config['host']) - if Env.setting('ipv6', default = False): - try: server.listen(config['port'], config['host6']) - except: log.info2('Tried to bind to IPV6 but failed') + if Env.setting('ipv6', default = False): + try: server.listen(config['port'], config['host6']) + except: log.info2('Tried to bind to IPV6 but failed') loop.start()