def __init__(self, debug): self.__debug = debug Daemon.__init__(self) self.__registerMethods() self.device_list = [] self.__detector_daemon = DetectorDaemon(self.device_list, self.__debug) self.__detector_daemon.start()
def __init__(self, pidfile, argv): Daemon.__init__(self, pidfile) reload(sys) sys.setdefaultencoding('utf-8') # acquire cookie cookie_jar = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie_jar)) urllib2.install_opener(opener) self.parser = optparse.OptionParser(self.MSG_USAGE) self.parser.add_option('-d', '--dbd', action='store_true', dest='dbd', help="DBD",default=False) self.parser.add_option('-u', '--undbd', action='store_true', dest='undbd', help="Un-DBD",default=False) self.parser.add_option('-i', '--input', action='store_true', dest='input', help="Input name & password",default=False) self.parser.add_option('-t', '--time', action='store_true', dest='time', help="Auto time card",default=False) self.parser.add_option('-g', '--debug', action='store_true', dest='debug', help="for debug",default=False) self.parser.add_option('--sync', action='store_true', dest='sync', help="Sync data with server",default=False) self.parser.add_option('--local', action='store_true', dest='local', help="Not sync with server",default=False) self.parser.add_option('--nodaemon', action='store_true', dest='nodaemon', help="Start with no-daemon",default=False) self.options, self.args = self.parser.parse_args(argv) hdlr = logging.FileHandler(self.log_file) formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') hdlr.setFormatter(formatter) self.logger.addHandler(hdlr) self.logger.setLevel(logging.INFO)
def __init__(self, pidfile, cfgfile): Daemon.__init__(self, pidfile) self.jobs = {} self.immediately = False self.scheduler = Scheduler(daemonic=False) self.logger = logging.getLogger(self.__class__.__name__) if os.path.exists(cfgfile): with open(cfgfile, 'rt') as f: config = yaml.load(f.read()) for k1 in config.keys(): if k1 == 'version': pass if k1 == 'immediately': self.immediately = config[k1] elif k1 == 'taobao': self.jobs[k1] = config[k1] self.jobs[k1]['id'] = None if 'chktime' in self.jobs[k1].keys(): self.jobs[k1]['btime'] = time.strptime(self.jobs[k1]['chktime'].split('-')[0], '%H:%M') self.jobs[k1]['etime'] = time.strptime(self.jobs[k1]['chktime'].split('-')[1], '%H:%M') if self.jobs[k1]['btime'] >= self.jobs[k1]['etime']: raise ValueError('"chktime" is illegal') else: raise ValueError('There is no "chktime" be found in configure.') else: pass else: self.logger.error('{0} not found'.format(cfgfile))
def __init__(self, filePath, flag): self.flag = flag Daemon.__init__(self, filePath) FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' logging.basicConfig(filename='log.txt', level=logging.INFO, format=FORMAT)
def __init__(self, pid_file, sent=None): Daemon.__init__(self, pid_file) c = config.Config() self.config = c.cfg # self.log = logging.getLogger('trends') self.stats_freq = 3600 self.sid = SentimentIntensityAnalyzer()
def __init__(self, nicename, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): Daemon.__init__(self, nicename, pidfile, stdin, stdout, stderr)
def __init__(self, configFilePath='/usr/local/hen/etc/configs/config'): Daemon.__init__(self) self.__version = "Console Daemon v0.2 (dumb)" self.__terminalServerConnections = {} self.__terminalServerSockets = [] self.__configFilePath = configFilePath self.__configFile = ConfigParser.ConfigParser() self.__configFile.read(configFilePath) self.__henPhysicalTopology = self.__configFile.get('MAIN','PHYSICAL_TOPOLOGY') self.__henLogPath = self.__configFile.get('MAIN', 'LOG_PATH') self.__parser = HenParser(self.__henPhysicalTopology, \ None, \ None, \ self.__henLogPath, \ None, None, None, \ None) self.__controlProtocol = None # Create instances for all terminal servers in the testbed self.__terminalServerNodes = {} for terminalServerNode in self.__parser.getNodes("serial", "all").values(): self.__terminalServerNodes[terminalServerNode.getNodeID()] = terminalServerNode.getInstance() self.__computerNodes = self.__parser.getNodes("computer", "all") self.__registerMethods()
def __init__(self, config_file): """CdmaAlarm class structure method. """ self.config_file = config_file self.config = ConfigParser() if os.path.exists(self.config_file): self.config.read(self.config_file) if not self.config.has_section("omp"): print("No such section.") sys.exit() else: self.omp_host = self.config.get("omp", "omp_host") self.omp_port = self.config.getint("omp", "omp_port") self.omp_user = self.config.get("omp", "omp_user") self.omp_passwd = self.config.get("omp", "omp_passwd") self.omp_old_passwd = self.config.get("omp", "omp_passwd_old") self.logfile = self.config.get("omp", "omp_alarm_log") self.omp_alarm_pid = self.config.get("omp", "omp_alarm_pid") self.interval = self.config.getint("omp", "omp_alarm_interval") if not self.config.has_section("mysql"): print("No such section.") sys.exit() else: self.mysql_host = self.config.get("mysql", "mysql_host") self.mysql_port = self.config.getint("mysql", "mysql_port") self.mysql_user = self.config.get("mysql", "mysql_user") self.mysql_passwd = self.config.get("mysql", "mysql_passwd") self.mysql_db = self.config.get("mysql", "mysql_db") else: print('CDMA configure file is not exist.') sys.exit() Daemon.__init__(self, self.omp_alarm_pid)
def __init__(self, pidfile, confile): '''ZhwhPanCity class structure method. ''' Daemon.__init__(self, pidfile) self.confile = confile self.config = ConfigParser.ConfigParser() if os.path.exists(self.confile): self.config.read(self.confile) if not self.config.has_section("pancity"): print("No such section.") sys.exit() else: self.mail_smtp_host = self.config.get("pancity", "mail_smtp_host") self.mail_smtp_port = self.config.getint("pancity", "mail_smtp_port") self.mail_from = self.config.get("pancity", "mail_from") self.mail_password = self.config.get("pancity", "mail_password") self.mail_to = self.config.get("pancity", "mail_to") self.xls_path = self.config.get("pancity", "pancity_xls_path") self.interval = self.config.getint("pancity", "pancity_interval") self.logfile = self.config.get("pancity", "pancity_log") if not self.config.has_section("mysql"): print("No such section.") sys.exit() else: self.myHost = self.config.get("mysql", "mysql_host") self.myPort = self.config.getint("mysql", "mysql_port") self.myUser = self.config.get("mysql", "mysql_user") self.myPasswd = self.config.get("mysql", "mysql_passwd") self.myDB = self.config.get("mysql", "mysql_db") else: print("ZHWH configure file is not exist.") sys.exit()
def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): Daemon.__init__(self, pidfile, stdin, stdout, stderr) self.systems = {"otc-gfxtest-bsw-01.local" : { "switch":1, "outlet":1 }, "otc-gfxtest-bsw-02.local" : { "switch":1, "outlet":2 }, "otc-gfxtest-bsw-03.local" : { "switch":1, "outlet":3 }, "otc-gfxtest-bsw-04.local" : { "switch":1, "outlet":4 }, "otc-gfxtest-bsw-05.local" : { "switch":1, "outlet":5 }, "otc-gfxtest-bsw-06.local" : { "switch":1, "outlet":6 }, # "otc-gfxtest-bsw-07.local" : { "switch":1, "outlet":7 }, # "otc-gfxtest-sklgt2-01.local" : { "switch":1, "outlet":8}, # byt does not boot after power loss # "otc-gfxtest-byt-01.local" : { "switch":2, "outlet":1 }, # "otc-gfxtest-byt-02.local" : { "switch":2, "outlet":2 }, # "otc-gfxtest-byt-03.local" : { "switch":2, "outlet":3 }, # "otc-gfxtest-byt-04.local" : { "switch":2, "outlet":4 }, "otc-gfxtest-kbl-01.local" : { "switch":2, "outlet":5 }, "otc-gfxtest-kbl-02.local" : { "switch":2, "outlet":4 }, "otc-gfxtest-bxt-02.local" : { "switch":2, "outlet":6 }, "otc-gfxtest-bxt-01.local" : { "switch":2, "outlet":7 }, "otc-gfxtest-sklgt2-02.local" : { "switch":2, "outlet":8}} self.switches = { 1 : PowerSwitch(hostname="192.168.1.2", userid="admin", password="******"), 2: PowerSwitch(hostname="192.168.1.3", userid="admin", password="******") } self.hangs = []
def __init__(self): cur_path = os.path.dirname(os.path.abspath(__file__)) self.app = webapp.create_app() self.app.debug = True self.port = get_config().getint("setup", "listen_port") self.pidfile = os.path.join(cur_path, "..", get_config().get("setup", "pidpath")) Daemon.__init__(self, self.pidfile)
def __init__(self, project=None): Daemon.__init__(self, project, program_type) self.object_list = None self.project_id = None self.message_script = None self.username = None self.password = None
def __init__(self, config_file): """CdmaSms class structure method. """ config = configparser.ConfigParser() if os.path.exists(config_file): config.read(config_file) if not config.has_section("sms"): print("No 'sms' section.") sys.exit() else: self.sms_host = config.get("sms", "sms_host") self.sms_port = config.getint("sms", "sms_port") self.sms_user = config.get("sms", "sms_user") self.sms_passwd = config.get("sms", "sms_passwd") self.sms_send_uri = config.get("sms", "sms_send_uri") self.logfile = config.get("sms", "sms_log") self.sms_pid = config.get("sms", "sms_pid") self.interval = config.getint("sms", "sms_interval") if not config.has_section("mysql"): print("No 'mysql' section.") sys.exit() else: self.mysql_host = config.get("mysql", "mysql_host") self.mysql_port = config.getint("mysql", "mysql_port") self.mysql_user = config.get("mysql", "mysql_user") self.mysql_passwd = config.get("mysql", "mysql_passwd") self.mysql_db = config.get("mysql", "mysql_db") else: print("CDMA configure file is not exist.") sys.exit() Daemon.__init__(self, self.sms_pid)
def __init__(self, useSSL=True): Daemon.__init__(self, useSSL) self.__MIN_ID = 100000 self.__MAX_ID = 100000000 self.__SESSION_TIMEOUT_HOURS = 48 self.__loggedInUsers = {} self.__reverseLoggedInUsers = {} self.__userProtocols = {} self.__systemProtocol = Protocol(None) self.__controlProtocol = Protocol(None) try: self.__systemProtocol.open(DaemonLocations.systemDaemon[0], DaemonLocations.systemDaemon[1]) except: print "warning, could not connect to system daemon" try: self.__controlProtocol.open(DaemonLocations.controlDaemon[0], DaemonLocations.controlDaemon[1]) except: print "warning, could not connect to control daemon" self.registerMethodHandler("login", self.login) self.registerMethodHandler("logout", self.logout) self.registerMethodHandler("system", self.systemOperation) self.registerMethodHandler("control", self.controlOperation) self.__consoleOperationReply = None self.__controlOperationReply = None self.__systemOperationReply = None self.__ldapClient = LDAPClient("ldap://henldap:389")
def __init__(self,pidfile,logfile_path = None,amqp_host = 'localhost',svm_save_filename = None, status_filename = None, X_filename = None, y_filename = None): if args: self.log = Logger(logfile_path,args.verbose) else: self.log = Logger(logfile_path) #For progress messages self.files_processed = 0 #Make sure pickle supports compress pickle.HIGHEST_PROTOCOL self.svc = svm.SVC(kernel="linear") self.X_filename = os.path.abspath(X_filename) if X_filename else None self.y_filename = os.path.abspath(y_filename) if y_filename else None self.__X = None self.__y = None self.amqp_host = amqp_host self.amqp_queue = 'classifyd' self.svm_filename = os.path.abspath(svm_save_filename) if svm_save_filename else None self.status_filename = status_filename if self.status_filename and os.path.exists(self.status_filename): #if the file exists, try to load it from there f = open(self.status_filename,'rb') self.status = pickle.load(f) f.close() else: #if not, then assume we are starting over self.status = Status() #call the parent's __init__ to initialize the daemon variables Daemon.__init__(self,pidfile)
def __init__(self, project=None): Daemon.__init__(self, project, program_type) self.project_id = None self.object_list = None self.account_login = None self.account_pin = None self.organizer_script = None
def __init__(self, *args, **kwargs): self.sb = None self.params = None self.nodes = None self.processes = {} self.running = True Daemon.__init__(self, *args, **kwargs)
def __init__(self, project=None): Daemon.__init__(self, project, program_type) self.project_id = None self.object_list = None self.data_filter = None self.data_organizer = None self.para_reference_name_list = None
def __init__(self): Daemon.__init__(self) self.__hen_manager = HenManager() self.__hen_manager.initLogging() self.__hardware_processor = LSHardwareProcessor(self.__hen_manager, \ self.__parseMacTableURL()) self.__registerMethods()
def __init__(self, pidfile, confile): '''CdmaAlarm class structure method. ''' Daemon.__init__(self, pidfile) self.confile = confile self.config = ConfigParser.ConfigParser() if os.path.exists(self.confile): self.config.read(self.confile) if not self.config.has_section("omp"): print("No such section.") sys.exit() else: self.fwHost = self.config.get("omp", "fw_host") self.fwPort = self.config.getint("omp", "fw_port") self.fwUser = self.config.get("omp", "fw_user") self.fwPasswd = self.config.get("omp", "fw_passwd") self.ompUser = self.config.get("omp", "omp_user") self.ompPasswd = self.config.get("omp", "omp_passwd") self.ompOldPasswd = self.config.get("omp", "omp_passwd_old") self.logfile = self.config.get("omp", "omp_alarm_log") self.interval = self.config.getint("omp", "omp_alarm_interval") if not self.config.has_section("mysql"): print("No such section.") sys.exit() else: self.myHost = self.config.get("mysql", "mysql_host") self.myPort = self.config.getint("mysql", "mysql_port") self.myUser = self.config.get("mysql", "mysql_user") self.myPasswd = self.config.get("mysql", "mysql_passwd") self.myDB = self.config.get("mysql", "mysql_db") else: print("CDMA configure file is not exist.") sys.exit()
def __init__( self, configLoc, pidfile="/tmp/httpJsonStats.pid", stdin="/dev/null", stdout="/tmp/httpJson.log", stderr="/tmp/httpJson.log", ): self.configLoc = configLoc self._jsonStr = "" self._CARBON_SERVER = "server.domain.com" self._CARBON_PORT = 2003 self._delay = 20 self._stdin = stdin self._stdout = stdout self._stderr = stderr self._pidfile = pidfile self._evaluateConfig() if self._jsonStr["global"]["GRAPHITE_SERVER"]: self._CARBON_SERVER = self._jsonStr["global"]["GRAPHITE_SERVER"] if self._jsonStr["global"]["GRAPHITE_PORT"]: self._CARBON_PORT = self._jsonStr["global"]["GRAPHITE_PORT"] if self._jsonStr["global"]["INTERVAL"]: self._delay = self._jsonStr["global"]["INTERVAL"] if self._jsonStr["global"]["LOG_FILE"]: self._stdout = self._jsonStr["global"]["LOG_FILE"] if self._jsonStr["global"]["ERR_LOG_FILE"]: self._stderr = self._jsonStr["global"]["ERR_LOG_FILE"] if self._jsonStr["global"]["PID_FILE"]: self._pidfile = self._jsonStr["global"]["PID_FILE"] del self._jsonStr["global"] Daemon.__init__(self, self._pidfile, self._stdin, self._stdout, self._stderr)
def __init__(self,pidfile=None): pidfile = pidfile or PidFile(PID_NAME, PID_DIR).get_path() Daemon.__init__(self,pidfile) self.basic_plugin=['ServerPlugin'] config=agentConfig.get_config() self.sender = Sender(port=config['recv_port']) self.check_frequency=config['check_freq']
def __init__(self): Daemon.__init__(self) # Initalise variables self.__henManager = HenManager() self.__nodes = None self.__vlans = {} # self.__vlan_info = {} # switch_name -> [vlan_name,vlan_name,...] self.__switch_instances = {} self.__test_mode = False self.__minimum_id = 200 self.__maximum_id = 2000 self.__vlanOwnerFilename = "/usr/local/hen/etc/switchd/vlan_owner.dat" self.__int_to_vlan = {} # (computer_str,interface_str) -> vlan_name self.__switchdb = SwitchDB() log.debug("Switchdb " + str(self.__switchdb)) # Register hen rpc methods and handlers log.debug("Registering methods") self.__registerMethods() # Load vlan info log.debug("Loading vlan info") self.__initaliseVlanInfo() # Setup mac polling log.debug("Loading henmanager") self.__switchdb.setHenManager(self.__henManager) log.debug("Loading links Db") self.__switchdb.loadLinksDb() log.debug("Initiating Nodes") self.initiateNodes() # vlan owners self.__vlan_owner_name = {} self.__vlan_name_owner = {} self.loadVlanOwnerFile()
def __init__(self): Daemon.__init__(self) # Initalise variables self.__henManager = HenManager() self.__nodes = None self.__vlans = {} # self.__vlan_info = {} # switch_name -> [vlan_name,vlan_name,...] self.__switch_instances = {} self.__test_mode = False self.__minimum_id = 200 self.__maximum_id = 2000 self.__vlanOwnerFilename = "/usr/local/hen/etc/switchd/vlan_owner.dat" self.__int_to_vlan = {} # (computer_str,interface_str) -> vlan_name self.__switchdb = SwitchDB() log.debug("Switchdb "+str(self.__switchdb)) # Register hen rpc methods and handlers log.debug("Registering methods") self.__registerMethods() # Load vlan info log.debug("Loading vlan info") self.__initaliseVlanInfo() # Setup mac polling log.debug("Loading henmanager") self.__switchdb.setHenManager(self.__henManager) log.debug("Loading links Db") self.__switchdb.loadLinksDb() log.debug("Initiating Nodes") self.initiateNodes() # vlan owners self.__vlan_owner_name = {} self.__vlan_name_owner = {} self.loadVlanOwnerFile()
def __init__(self, pidfile, confile): '''CdmaSms class structure method. ''' Daemon.__init__(self, pidfile) config = ConfigParser.ConfigParser() if os.path.exists(confile): config.read(confile) if not config.has_section("sms"): print("No 'sms' section.") sys.exit() else: self.smsHost = config.get("sms", "sms_host") self.smsPort = config.getint("sms", "sms_port") self.smsUser = config.get("sms", "sms_user") self.smsPasswd = config.get("sms", "sms_passwd") self.smsSendUri = config.get("sms", "sms_send_uri") self.logfile = config.get("sms", "sms_log") self.interval = config.getint("sms", "sms_interval") if not config.has_section("mysql"): print("No 'mysql' section.") sys.exit() else: self.myHost = config.get("mysql", "mysql_host") self.myPort = config.getint("mysql", "mysql_port") self.myUser = config.get("mysql", "mysql_user") self.myPasswd = config.get("mysql", "mysql_passwd") self.myDB = config.get("mysql", "mysql_db") else: print("CDMA configure file is not exist.") sys.exit()
def __init__(self, pidf): Daemon.__init__(self, pidf) self.known_ssids = {} config = self.read_config() self.iface = config["ssid_detection"]["interface"] self.errorlog = config["ssid_detection"]["errorlog"] self.ssid_file = config["ssid_detection"]["known_ssids"] self.sleeptime = config["ssid_detection"]["sleeptime"]
def __init__(self, project=None): Daemon.__init__(self, project, program_type) self.project_id = None self.object_list = None self.organizer_script = None self.account_login = None self.account_pin = None self._schedule = sched.scheduler(time.time, time.sleep)
def __init__(self, pidf): Daemon.__init__(self, pidf) self.metric = Metric_Fling() self.data = [] config = self.read_config() self.sleeptime = config["ap_metrics"]["sleeptime"] self.iface = config["ap_metrics"]["interface"] self.pktcount = config["ap_metrics"]["pktcount"]
def __init__(self, pid_path, configParser): Daemon.__init__(self, pid_path) self.configParser = configParser logging.basicConfig( filename=self.configParser.get('logging', 'filepath'), level=levels[self.configParser.get('logging', 'loglevel')], format=self.configParser.get('logging', 'logformat'), )
def __init__(self, pid_file, logger, stdin_file='/dev/null', stdout_file='/dev/null', stderr_file='/dev/null'): Daemon.__init__(self, pid_file, logger, stdin_file, stdout_file, stderr_file)
def __init__(self, host, port, name="WORKER_DAEMON"): Daemon.__init__(self, host, port, name) # self.job_ps_process = {} # self.job_worker_process = {} self.worker_status = Status.FREE self.worker_status_lock = Lock()
def __init__( self, timeinterval = 30, logfile = "machine_%s.log" % MachineTools.getMachineName(), loglevel = logging.INFO ): curfile = os.path.basename( sys._getframe().f_code.co_filename ) curfile, ext = os.path.splitext( curfile ) pidfile = os.path.abspath( curfile + "_" + MachineTools.getMachineName() + ".pid" ) Daemon.__init__( self, os.path.abspath( pidfile ) ) self.timeInterval = timeinterval self.targetFile = logfile self.logLevel = loglevel
def __init__(self, config=CONFIG_FILE): """\brief Registers remote methods and starts update thread (timer) """ Daemon.__init__(self) self.__config_path = config self.__parseConfig(self.__config_path) self.__registerMethods() self.__checker_lock = threading.Lock()
def __init__(self, **kwargs): self.interval = 10 self.config = ConfigParser.RawConfigParser() self.config.read(CONFIG_FILE) Daemon.__init__(self, pidfile=self.config.get('global', 'pid_file'), **kwargs)
def __init__(self, project=None): Daemon.__init__(self, project, program_type) self.project_id = None self.object_list = None self.para_reference_name_list = None self.new_parameter_name_list = None self.script = None self.min_max = None
def __init__(self): self.readConfig(CONFIG_FILE) Daemon.__init__(self,self.PIDFILE) self.alerts = {} self.dict_modified = 0 self.delay_window = 0 self.last_notification = 0 self.host_name = ''
def __init__(self, config=None, section=None): """ override parent __init__, then run it at end """ self.conf = config self.sect = section prefix = self.conf.get(self.sect, 'log')+'/'+self.sect Daemon.__init__(self, prefix+'.pid', stdout=prefix+'.log', stderr=prefix+'.log')
def __init__(self, pid_file): """ Constructor """ logging.basicConfig(filename='log_tweets.txt',level=logging.DEBUG) Daemon.__init__(self, pid_file) self.db = None print "constructor"
def __init__(self, instance): self.prefix = './instances/%s' % instance self.sigterm = False pidfile = self.prefix + os.sep + 'worker.pid' stderr = self.prefix + os.sep + 'worker.err' Daemon.__init__(self, pidfile, stderr=stderr)
def __init__(self, name): Daemon.__init__(self, name, "-1") # check that independent beams is off if self.cfg["INDEPENDENT_BEAMS"] == "1": raise Exception("StreamDaemon incompatible with INDEPENDENT_BEAMS") self.req_host = self.cfg["SERVER_HOST"] self.log_dir = self.cfg["SERVER_LOG_DIR"] self.control_dir = self.cfg["SERVER_CONTROL_DIR"]
def __init__( self, confFile, pidFile, logFile, handlefulllog, beforedays = 0 ): Daemon.__init__( self, pidFile ) self.confFile = confFile self.pidFile = pidFile self.logFile = logFile self.beforeDays = beforedays self.handleFullLog = handlefulllog # save datas defined in config file self.datas = []
def __init__(self, pid_file): """ Constructor """ logging.basicConfig(filename='log_tweets.txt', level=logging.DEBUG) Daemon.__init__(self, pid_file) self.db = None c = config.Config() self.config = c.cfg
def __init__(self): Daemon.__init__(self) self.__henManager = HenManager() # Allow specialized instance dictionary to be created in hm # self.__henManager.createNodeInstances() self.__registerMethods() self.__computerID = self.__getComputerID() self.__computerInfo = self.__henManager.getNodes("computer")[self.__computerID] self.__ifaceIDtoNameMappings = self.__getIfaceMappings()
def __init__ (self, name): Daemon.__init__(self, name, "-1") # check that independent beams is off if self.cfg["INDEPENDENT_BEAMS"] == "1": raise Exception ("ServerDaemons incompatible with INDEPENDENT_BEAMS") self.req_host = self.cfg["SERVER_HOST"] self.log_dir = self.cfg["SERVER_LOG_DIR"] self.control_dir = self.cfg["SERVER_CONTROL_DIR"]
def __init__(self, conf): Daemon.__init__(self, 'daemon-rss.pid') self.conf = conf self.catalog = catalogo() self.locks = {} self.rss_urls = [ "http://www.ezrss.it/feed", "http://eztv.ptain.info/cgi-bin/eztv.pl?id=index&name=Latest%20Releases" ]
def __init__(self, port, tmsHost, tmsPort, handler, processor, EOCString=None, sslConnection=False, keyfile=None, certfile=None, ca_certs=None, verboseMode=False, logFileTMMS=None): try: os.remove('/tmp/TMMS.%s.pid' % user) except: pass Daemon.__init__(self,'/tmp/TMMS.%s.pid' % user) self.host=os.uname()[1] self.port=port self.startTime = strftime("%d %b %Y, %H.%M.%S") # strftime("%Y %m %d %H.%M.%S") self.ID = int(time()) self.tmsHost=tmsHost self.tmsPort=tmsPort self.user=user self.EOCString=EOCString self.sslConnection=sslConnection self.keyfile=keyfile self.certfile=certfile self.ca_certs=ca_certs self.processor = processor #self.infoSockets = [] self.verboseMode = verboseMode self.logFileTMMS = logFileTMMS # db connection dbconnection = hDBConnection() # get database id of host try: self.hostID=dbconnection.query( db.Host.id ).filter( db.Host.full_name==self.host ).one()[0] except: sys.stderr.write( "Host is not known by TaskManager!" ) sys.exit(-1) # save database ids of some entries in self.databaseIDs self.databaseIDs = dict( dbconnection.query( db.JobStatus.name, db.JobStatus.id ).all() ) # start the server SocketServer.TCPServer.__init__(self,(self.host,self.port), handler)
def __init__(self, etbd, logfile, pidfile, directory, port): Daemon.__init__(self, pidfile, stdin=logfile, stdout=logfile, stderr=logfile) self.etbd = etbd self.port = port self.directory = directory
def __init__(self,Config): self.Config = Config pidfile = Config.pid_filename stdin = '/dev/null' stdout = '/dev/null' stderr = '/dev/null' if Config.log_filename != "": stderr = Config.log_filename Daemon.__init__(self, pidfile, stdin, stdout, stderr)
def __init__(self, regexp, metric_map, pid): Daemon.__init__(self, pid, stdin="/dev/null", stdout="/dev/null", stderr="/dev/null") self.regexp = regexp self.metric_map = metric_map self.read_config("/usr/local/etc/lemon.ini")
def __init__( self, confFile, pidFile, logFile, handlefulllog = False, beforedays = 0 , notimestamp = False ): Daemon.__init__( self, pidFile, stderr=logFile, stdout=logFile) self.confFile = confFile self.pidFile = pidFile self.logFile = logFile self.beforeDays = beforedays self.handleFullLog = handlefulllog self.noTimeStamp = notimestamp # save datas defined in config file self.datas = []
def __init__(self, pidfile, autorestart, start_event=True, in_developer_mode=False): Daemon.__init__(self, pidfile, autorestart=autorestart) self.run_forever = True self.collector = None self.start_event = start_event self.in_developer_mode = in_developer_mode
def __init__(self, pidfile, autorestart, start_event=True, in_developer_mode=False): Daemon.__init__(self, pidfile, autorestart=autorestart) self.run_forever = True self.collector = None self.start_event = start_event self.in_developer_mode = in_developer_mode self._agentConfig = {} self._checksd = [] self.collector_profile_interval = DEFAULT_COLLECTOR_PROFILE_INTERVAL self.check_frequency = None self.configs_reloaded = False
def __init__(self, *args, **kwargs): """ Constructor. """ Daemon.__init__(self, *args, **kwargs) #initialize the base class self.user_name = 'sealion' #user name for daemon self.monit_interval = 30 #monitoring interval for monit.sh self.crash_loop_count = 5 #count of crash dumps to determine crash loop self.monit_pid = -1 #pid of monit.sh self.crash_dump_path = '%svar/crash/' % exe_path #crash dump path
def __init__(self, config=None, section=None): """ override parent __init__, then run it at end """ self.conf = config self.sect = section prefix = self.conf.get(self.sect, 'log') + '/' + self.sect Daemon.__init__(self, prefix + '.pid', stdout=prefix + '.log', stderr=prefix + '.log')
def __init__(self, app_path=None): self._app_path = None self._dev_id = 0 self._dev_sock = None self._is_terminate = False self._old_filter = None if app_path is None: self.app_path = os.path.dirname(os.path.abspath(__file__)) pidfile = os.path.join(self.app_path, "CapLocApp.pid") Daemon.__init__(self, pidfile)
def __init__(self, *args, **kwargs): """ Constructor. """ Daemon.__init__(self, *args, **kwargs) #initialize the base class self.crash_loop_timeout = 30 #timeout between each crash and resurrect self.crash_loop_count = 5 #count of crash dumps to determine crash loop self.crash_dump_path = '%s/var/crash/' % exe_path #crash dump path self.crash_dump_pattern = r'^sealion-%s-[0-9]+\.dmp$' self.agent_version_regex = r'(\d+\.){2}\d+(\.[a-z0-9]+)?'