mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-25 21:42:21 +03:00
updated ahenk deamon
This commit is contained in:
parent
128290359d
commit
f0e023cc82
2 changed files with 30 additions and 12 deletions
|
@ -5,28 +5,47 @@
|
||||||
from base.config.ConfigManager import ConfigManager
|
from base.config.ConfigManager import ConfigManager
|
||||||
from base.deamon.BaseDeamon import BaseDeamon
|
from base.deamon.BaseDeamon import BaseDeamon
|
||||||
from base.logging.AhenkLogger import Logger
|
from base.logging.AhenkLogger import Logger
|
||||||
|
from base.Scope import Scope
|
||||||
import sys,logging
|
import sys,logging
|
||||||
|
|
||||||
|
|
||||||
class AhenkDeamon(BaseDeamon):
|
class AhenkDeamon(BaseDeamon):
|
||||||
"""docstring for AhenkDeamon"""
|
"""docstring for AhenkDeamon"""
|
||||||
|
globalscope=None
|
||||||
def __init__(self, arg):
|
def __init__(self, arg):
|
||||||
super(AhenkDeamon, self).__init__()
|
super(AhenkDeamon, self).__init__()
|
||||||
self.arg = arg
|
self.arg = arg
|
||||||
|
global globalscope
|
||||||
|
globalscope=Scope()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def scope():
|
||||||
|
return globalscope
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
global globalscope
|
||||||
|
configFilePath='/etc/ahenk/ahenk.conf'
|
||||||
|
configfileFolderPath='/etc/ahenk/config.d/'
|
||||||
|
|
||||||
|
#configuration manager must be first load
|
||||||
|
configManager = ConfigManager(configFilePath,configfileFolderPath)
|
||||||
|
config = configManager.read()
|
||||||
|
globalscope.setConfigurationManager(config)
|
||||||
|
|
||||||
|
logger = Logger()
|
||||||
|
logger.info("obaraaa")
|
||||||
|
globalscope.setLogger(logger)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
configFilePath='/etc/ahenk/ahenk.conf'
|
|
||||||
configfileFolderPath='/etc/ahenk/config.d/'
|
|
||||||
pidfilePath='/var/run/ahenk.pid'
|
pidfilePath='/var/run/ahenk.pid'
|
||||||
|
|
||||||
configManager = ConfigManager(configFilePath,configfileFolderPath)
|
|
||||||
config = configManager.read()
|
|
||||||
|
|
||||||
logger = Logger('/tmp/ahenk.log',logging.DEBUG)
|
|
||||||
logger.info("obaraaa")
|
|
||||||
|
|
||||||
"""
|
|
||||||
deamon = AhenkDeamon(pidfilePath)
|
deamon = AhenkDeamon(pidfilePath)
|
||||||
|
|
||||||
if len(sys.argv) == 2:
|
if len(sys.argv) == 2:
|
||||||
|
@ -46,4 +65,3 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
print 'Usage : %s start|stop|restart|status' % sys.argv[0]
|
print 'Usage : %s start|stop|restart|status' % sys.argv[0]
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
"""
|
|
|
@ -23,7 +23,7 @@ class Scope(object):
|
||||||
def getConfigurationManager(self):
|
def getConfigurationManager(self):
|
||||||
return self.configurationManager
|
return self.configurationManager
|
||||||
|
|
||||||
def serConfigurationManager(self,configurationManager):
|
def setConfigurationManager(self,configurationManager):
|
||||||
self.configurationManager = configurationManager
|
self.configurationManager = configurationManager
|
||||||
|
|
||||||
def getLogger(self):
|
def getLogger(self):
|
||||||
|
|
Loading…
Reference in a new issue