clean stop script
authorThomasV <thomasv1@gmx.de>
Mon, 17 Feb 2014 17:28:30 +0000 (18:28 +0100)
committerThomasV <thomasv1@gmx.de>
Mon, 17 Feb 2014 17:28:30 +0000 (18:28 +0100)
backends/irc/__init__.py
stop

index cf830b9..8dae94e 100644 (file)
@@ -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 (executable)
--- 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."