From a4a9a2b0b0003d5b3b6a323ad040b6e25a851690 Mon Sep 17 00:00:00 2001 From: Job Evers-Meltzer Date: Mon, 2 Jan 2017 12:06:57 -0600 Subject: [PATCH] fix the stop script --- lbrynet/lbrynet_daemon/DaemonControl.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lbrynet/lbrynet_daemon/DaemonControl.py b/lbrynet/lbrynet_daemon/DaemonControl.py index 9faeadc47..33a8568b9 100644 --- a/lbrynet/lbrynet_daemon/DaemonControl.py +++ b/lbrynet/lbrynet_daemon/DaemonControl.py @@ -10,8 +10,8 @@ from jsonrpc.proxy import JSONRPCProxy from lbrynet import analytics from lbrynet import conf from lbrynet.core import utils +from lbrynet.lbrynet_daemon.auth import client from lbrynet.lbrynet_daemon.DaemonServer import DaemonServer -from lbrynet import conf log = logging.getLogger(__name__) @@ -22,19 +22,15 @@ def test_internet_connection(): def stop(): - def _disp_shutdown(): - print "Shutting down lbrynet-daemon from command line" + conf.initialize_settings() + log_support.configure_console() + try: + client.LBRYAPIClient.config().stop() + except Exception: + log.exception('Failed to stop deamon') + else: log.info("Shutting down lbrynet-daemon from command line") - def _disp_not_running(): - print "Attempt to shut down lbrynet-daemon from command line when daemon isn't running" - log.info("Attempt to shut down lbrynet-daemon from command line when daemon isn't running") - - d = defer.Deferred(None) - d.addCallback(lambda _: JSONRPCProxy.from_url(conf.settings.API_CONNECTION_STRING).stop()) - d.addCallbacks(lambda _: _disp_shutdown(), lambda _: _disp_not_running()) - d.callback(None) - def start(): conf.initialize_settings()