diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 21:38:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 21:38:38 +0000 |
commit | 2e2851dc13d73352530dd4495c7e05603b2e520d (patch) | |
tree | 622b9cd8e5d32091c9aa9e4937b533975a40356c /deluge/ui/console/cmdline/commands/halt.py | |
parent | Initial commit. (diff) | |
download | deluge-ba36a3baaa52c6e8dc58a724548d75d3db6e8ef9.tar.xz deluge-ba36a3baaa52c6e8dc58a724548d75d3db6e8ef9.zip |
Adding upstream version 2.1.2~dev0+20240219.upstream/2.1.2_dev0+20240219upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'deluge/ui/console/cmdline/commands/halt.py')
-rw-r--r-- | deluge/ui/console/cmdline/commands/halt.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/deluge/ui/console/cmdline/commands/halt.py b/deluge/ui/console/cmdline/commands/halt.py new file mode 100644 index 0000000..608f2de --- /dev/null +++ b/deluge/ui/console/cmdline/commands/halt.py @@ -0,0 +1,32 @@ +# +# Copyright (C) 2008-2009 Ido Abramovich <ido.deluge@gmail.com> +# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com> +# +# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with +# the additional special exception to link portions of this program with the OpenSSL library. +# See LICENSE for more details. +# + +import deluge.component as component +from deluge.ui.client import client + +from . import BaseCommand + + +class Command(BaseCommand): + """Shutdown the deluge server.""" + + def handle(self, options): + self.console = component.get('ConsoleUI') + + def on_shutdown(result): + self.console.write('{!success!}Daemon was shutdown') + + def on_shutdown_fail(reason): + self.console.write('{!error!}Unable to shutdown daemon: %s' % reason) + + return ( + client.daemon.shutdown() + .addCallback(on_shutdown) + .addErrback(on_shutdown_fail) + ) |