summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-10-11 20:02:47 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-10-11 20:02:47 +0200
commit98f3ed1a9c99a07b15f54b78f521ad84ccbad126 (patch)
tree4a80604e1d4586891e354c6f83a7e05ac8960bc1
parentpavement build script (diff)
downloadpyload-98f3ed1a9c99a07b15f54b78f521ad84ccbad126.tar.xz
working restart core method
-rw-r--r--module/Api.py5
-rw-r--r--module/remote/thriftbackend/ThriftClient.py2
-rwxr-xr-xpyLoadCore.py9
3 files changed, 11 insertions, 5 deletions
diff --git a/module/Api.py b/module/Api.py
index 502792cf6..aad61cd5f 100644
--- a/module/Api.py
+++ b/module/Api.py
@@ -238,9 +238,8 @@ class Api(Iface):
self.core.do_kill = True
def restart(self):
- """Not working, not likely to ever will"""
- pass
- #self.core.do_restart = True
+ """Restart pyload core"""
+ self.core.do_restart = True
@permission(PERMS.STATUS)
def getLog(self, offset=0):
diff --git a/module/remote/thriftbackend/ThriftClient.py b/module/remote/thriftbackend/ThriftClient.py
index 7e60d9fdc..74363cf62 100644
--- a/module/remote/thriftbackend/ThriftClient.py
+++ b/module/remote/thriftbackend/ThriftClient.py
@@ -88,7 +88,7 @@ class ThriftClient:
if __name__ == "__main__":
- client = ThriftClient(user="User", password="")
+ client = ThriftClient(user="User", password="pwhere")
print client.getServerVersion()
print client.statusServer()
diff --git a/pyLoadCore.py b/pyLoadCore.py
index 9a32b78cc..ae84f111c 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -30,7 +30,7 @@ from imp import find_module
import logging
import logging.handlers
import os
-from os import _exit, execl, getcwd, makedirs, remove, sep, walk, chdir
+from os import _exit, execl, getcwd, makedirs, remove, sep, walk, chdir, close
from os.path import exists, join
import signal
import subprocess
@@ -544,6 +544,13 @@ class Core(object):
def restart(self):
self.shutdown()
chdir(owd)
+ # close some open fds
+ for i in range(3,50):
+ try:
+ close(i)
+ except :
+ pass
+
execl(executable, executable, *sys.argv)
_exit(0)