summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Pinto <markybob@dipconsultants.com>2007-10-15 00:14:01 +0000
committerMarcos Pinto <markybob@dipconsultants.com>2007-10-15 00:14:01 +0000
commit87fe5fe4ad8c02991f85671f7ba3d54782459cdc (patch)
tree1545199ddf0b246161870b1f4cc24d9c08eee25b
parentb6dd803a9543645590ee8726b2fdba2ba333bac5 (diff)
downloaddeluge-87fe5fe4ad8c02991f85671f7ba3d54782459cdc.tar.gz
deluge-87fe5fe4ad8c02991f85671f7ba3d54782459cdc.tar.bz2
deluge-87fe5fe4ad8c02991f85671f7ba3d54782459cdc.zip
fix start/stop
-rw-r--r--plugins/WebUi/__init__.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/plugins/WebUi/__init__.py b/plugins/WebUi/__init__.py
index 38f284092..569773c1e 100644
--- a/plugins/WebUi/__init__.py
+++ b/plugins/WebUi/__init__.py
@@ -79,11 +79,11 @@ class plugin_WebUi(object):
self.proc = None
self.web_server = None
if not deluge.common.windows_check():
- if os.WEXITSTATUS(os.system('ps x -o pid,args |grep -v grep |grep -q run_webserver')):
- import commands
- pid = commands.getoutput('ps x -o pid,args |grep -v grep |grep run_webserver |awk {\'print $1\'}')
- os.kill(pid, 9)
- time.sleep(1) #safe time to wait for kill to finish.
+ import commands
+ pid = commands.getstatus('ps x |grep -v grep |grep run_webserver |awk {\'print $1\'}')
+ if pid == 0:
+ os.kill(pid[1], 9)
+ time.sleep(1) #safe time to wait for kill to finish.
self.config_file = deluge.common.CONFIG_DIR + "/webui.conf"
self.config = deluge.pref.Preferences(self.config_file, False)
try:
@@ -162,12 +162,8 @@ class plugin_WebUi(object):
self.web_server.stop_gtk()
self.web_server = None
if self.proc:
- if os.WEXITSTATUS(os.system('ps x -o pid,args |grep -v grep |grep -q run_webserver')):
- import commands
- pid = commands.getoutput('ps x -o pid,args |grep -v grep |grep run_webserver |awk {\'print $1\'}')
- os.kill(pid, 9)
-# print "webserver: kill %i" % self.proc.pid
- # os.system("kill %i" % self.proc.pid)
+ print "webserver: kill %i" % self.proc.pid
+ os.system("kill -9 %i" % self.proc.pid)
time.sleep(1) #safe time to wait for kill to finish.
self.proc = None