Files
entropy/server/entropy-system-daemon
lxnay 374d5b11aa Entropy/System Manager Repository Daemon example:
- add community_repo bool switch


git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@2449 cd1c1023-2f26-0410-ae45-c471fc1f0318
2008-10-03 01:55:50 +00:00

61 lines
1.8 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
if "--ssl" in sys.argv:
do_ssl = True
if "--nostdout" in sys.argv:
do_stdout_logging = False
from entropyConstants import *
import entropyTools, exceptionTools
from entropy import SystemManagerServerInterface, SystemManagerExecutorServerRepositoryInterface, SystemManagerRepositoryCommands, ServerInterface
etpConst['community']['mode'] = True
def run_srv(s):
try:
s.go()
except (KeyboardInterrupt, SystemExit,):
s.killall()
srv_ssl = None
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']}
)
thread_names = ["system_socket"]
task = entropyTools.parallelTask(run_srv, srv)
task.setName(thread_names[0])
task.start()
while 1:
try:
time.sleep(1)
found = False
threads = entropyTools.threading.enumerate()
for thread in threads:
if thread.getName() in thread_names:
found = True
break
if not found:
break
except (KeyboardInterrupt, SystemExit,):
threads = entropyTools.threading.enumerate()
for thread in threads:
if thread.getName() in thread_names:
thread.args[0].killall()
raise SystemExit