From: ThomasV Date: Mon, 17 Feb 2014 17:28:30 +0000 (+0100) Subject: clean stop script X-Git-Url: https://git.novaco.in/?p=electrum-server.git;a=commitdiff_plain;h=23f11bedcccb15233563f936b85fdfa5505ee920 clean stop script --- diff --git a/backends/irc/__init__.py b/backends/irc/__init__.py index cf830b9..8dae94e 100644 --- a/backends/irc/__init__.py +++ b/backends/irc/__init__.py @@ -200,6 +200,10 @@ class ServerProcessor(Processor): elif method == 'server.version': result = VERSION + elif method == 'server.getpid': + import os + result = os.getpid() + elif method == 'server.stop': self.shared.stop() result = 'stopping, please wait until all threads terminate.' diff --git a/stop b/stop index 89b1111..42571c5 100755 --- a/stop +++ b/stop @@ -1,2 +1,6 @@ #!/bin/bash +PID=`/usr/bin/python server.py getpid` /usr/bin/python server.py stop +echo "Waiting until process $PID terminates..." +while ps -p $PID > /dev/null; do sleep 1; done +echo "Done."