Files
entropy/server/entropy-system-daemon
lxnay 76367c132b Entropy/Entropy System Daemon:
- small code refresh
Entropy/SystemManagerServerInterface:
- add thread lock on ServiceInterface


git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@2939 cd1c1023-2f26-0410-ae45-c471fc1f0318
2009-01-25 19:01:16 +00:00

56 lines
1.6 KiB
Python

#!/usr/bin/python
import sys, time
sys.path.insert(0,'/usr/lib/entropy/libraries')
sys.path.insert(0,'/usr/lib/entropy/client')
sys.path.insert(0,'../libraries')
sys.path.insert(0,'../client')
# disable pid management
sys.argv.append("--no-pid-handling")
do_ssl = False
do_stdout_logging = True
do_port = 1027
if "--ssl" in sys.argv:
do_ssl = True
if "--nostdout" in sys.argv:
do_stdout_logging = False
if "--port" in sys.argv:
idx = sys.argv.index("--port")+1
try:
do_port = int(sys.argv[idx])
except (IndexError, ValueError,):
pass
from entropyConstants import *
import entropyTools, exceptionTools
from entropy import SystemManagerServerInterface, SystemManagerExecutorServerRepositoryInterface, SystemManagerRepositoryCommands, ServerInterface
etpConst['community']['mode'] = True
etpConst['socket_service']['session_ttl'] = 300
def run_srv(s):
try:
s.go()
except (KeyboardInterrupt, SystemExit,):
s.killall()
srv = SystemManagerServerInterface(
ServerInterface,
do_ssl = do_ssl,
stdout_logging = do_stdout_logging,
external_cmd_classes = [SystemManagerRepositoryCommands],
external_executor_cmd_classes = [(SystemManagerExecutorServerRepositoryInterface,[],{},)],
entropy_interface_kwargs = {'community_repo': etpConst['community']['mode']}
)
srv.port = do_port
thread_names = ["system_socket"]
task = entropyTools.parallelTask(run_srv, srv)
task.setName(thread_names[0])
task.start()
try:
while task.isAlive():
time.sleep(1)
except KeyboardInterrupt:
raise SystemExit(1)
raise SystemExit(0)