You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
772 B
39 lines
772 B
#!/usr/bin/python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import sys, os, time
|
|
reload(sys)
|
|
sys.setdefaultencoding("utf-8")
|
|
|
|
cwd = os.getcwd()
|
|
sys.path.append(os.path.join(cwd,"sys"))
|
|
sys.path.append(os.path.join(cwd,"modules","active"))
|
|
|
|
print cwd
|
|
import demonize, brathuhn, config
|
|
#Demonize
|
|
if not demonize.demonize(config.PIDFILE,False,config.LOGFILE):
|
|
sys.stderr.write("Daemon already running")
|
|
sys.exit(1)
|
|
|
|
#Inport modules
|
|
modules = []
|
|
files = os.listdir( os.path.join(cwd,"modules","active") )
|
|
for f in files:
|
|
if f.endswith(".py"):
|
|
mod = f[:-3]
|
|
elif f.endswith(".pyc"):
|
|
mod = f[:-4]
|
|
else:
|
|
continue;
|
|
if not mod in modules:
|
|
modules.append(mod)
|
|
for mod in modules:
|
|
__import__(mod)
|
|
|
|
print "PID:", os.getpid()
|
|
|
|
#Start Brathuhn
|
|
brathuhn.connect_and_join()
|
|
brathuhn.loop()
|
|
|
|
|