def __daemon_main(settings): logging.info('') logging.info('================================= NEW SESSION =================================') logging.info('') control.start(settings[ARGUMENT_CONTROL_ADDR], settings[ARGUMENT_CONTROL_PORT]) run_logger(settings)
def doCron(watch): if config.Config.cronenabled == "0": return if not os.path.exists(os.path.join(config.Config.scriptsdir, "broctl-config.sh")): util.output("error: broctl-config.sh not found (try 'broctl install')") return config.Config.config["cron"] = "1" # Flag to indicate that we're running from cron. if not util.lock(): return util.bufferOutput() if watch: # Check whether nodes are still running an restart if neccessary. for (node, isrunning) in control.isRunning(config.Config.nodes()): if not isrunning and node.hasCrashed(): control.start([node]) # Check for dead hosts. _checkHosts() # Generate statistics. _logStats(5) # Check available disk space. _checkDiskSpace() # Expire old log files. _expireLogs() # Update the HTTP stats directory. _updateHTTPStats() # Run external command if we have one. if config.Config.croncmd: (success, output) = execute.runLocalCmd(config.Config.croncmd) if not success: util.output("error running croncmd: %s" % config.Config.croncmd) # Mail potential output. output = util.getBufferedOutput() if output: util.sendMail("cron: " + output.split("\n")[0], output) util.unlock() config.Config.config["cron"] = "0" util.debug(1, "cron done")
def doCron(watch): if config.Config.cronenabled == "0": return config.Config.config[ "cron"] = "1" # Flag to indicate that we're running from cron. if not util.lock(): return util.bufferOutput() if watch: # Check whether nodes are still running an restart if neccessary. for (node, isrunning) in control.isRunning(config.Config.nodes()): if not isrunning and node.hasCrashed(): control.start([node]) # Check for dead hosts. _checkHosts() # Generate statistics. _logStats(5) # Check available disk space. _checkDiskSpace() # Expire old log files. _expireLogs() # Update the HTTP stats directory. _updateHTTPStats() # Run external command if we have one. if config.Config.croncmd: execute.runLocalCmd(config.Config.croncmd) # Mail potential output. output = util.getBufferedOutput() if output: util.sendMail("cron: " + output.split("\n")[0], output) util.unlock() config.Config.config["cron"] = "0" util.debug(1, "cron done")
def doCron(): if config.Config.cronenabled == "0": return if not util.lock(): return util.bufferOutput() config.Config.config["cron"] = "1" # Flag to indicate that we're running from cron. # Check whether nodes are still running an restart if neccessary. for (node, isrunning) in control.isRunning(config.Config.nodes()): if not isrunning and node.hasCrashed(): control.start([node]) # Check for dead hosts. _checkHosts() # Generate statistics. _logStats(5) # Check available disk space. _checkDiskSpace() # Expire old log files. _expireLogs() # Update the HTTP stats directory. _updateHTTPStats() # Run external command if we have one. if config.Config.croncmd: execute.runLocalCmd(config.Config.croncmd) # Mail potential output. output = util.getBufferedOutput() if output: util.sendMail("cron: " + output.split("\n")[0], output) config.Config.config["cron"] = "0" util.unlock()
def set_ntp_time(timer): ntptime.host = "tempus1.gum.gov.pl" for i in range(1, 10): try: t = ntptime.time() tm = utime.localtime(t) tm = tm[0:3] + (0, ) + tm[3:6] + (0, ) RTC().datetime(tm) break except OSError: continue # def init_modules(): # config.init() micropython.alloc_emergency_exception_buf(500) machine.freq(160000000) timer = Timer(-1) timer.init(period=300 * 1000, mode=Timer.PERIODIC, callback=set_ntp_time) set_ntp_time(None) control.start(timer) mqtt_reporting.setup() print("\nGROWBOX INIT COMPLETE!") while True: mqtt_reporting.run() time.sleep_ms(60 * 1000)
### IoT Button Start import control control.start(False)
# Adam Bysice # # 0753709 # #################### import control #the command to start the program control.start()
import control as c c.start()