def action_restart(procname): try: cmd = "/usr/local/bin/god restart %s" %procname execute_cmd(cmd) return True except Exception, e: LOG.error(e)
def action_unmonitor(procname): try: cmd = "/usr/local/bin/god unmonitor %s" %procname execute_cmd(cmd) return True except Exception, e: LOG.error(e)
def action_unmonitor(procname): try: cmd = "/usr/local/bin/god unmonitor %s" % procname execute_cmd(cmd) return True except Exception, e: LOG.error(e)
def action_restart(procname): try: cmd = "/usr/local/bin/god restart %s" % procname execute_cmd(cmd) return True except Exception, e: LOG.error(e)
def action_remove(procname): try: cmd = "/usr/local/bin/god remove %s" %procname execute_cmd(cmd) result = delete_god_conf(procname) if not result: return False return True except Exception, e: LOG.error(e)
def action_remove(procname): try: cmd = "/usr/local/bin/god remove %s" % procname execute_cmd(cmd) result = delete_god_conf(procname) if not result: return False return True except Exception, e: LOG.error(e)
def ensure_god_start(): cmd = "god" execute_cmd(cmd) return #def get_ip_by_nic(ifname = 'eth0'): # s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # inet = fcntl.ioctl(s.fileno(), 0x8915, struct.pack('256s', ifname[:15])) # ret = socket.inet_ntoa(inet[20:24]) # return ret
def delete_god_conf(procname): try: god_dir = CONF.get("god", "etc_dir") if not god_dir: god_dir = CONF_GOD_ETC_DIR filename = procname + ".god" file_full_name = os.path.join(god_dir, filename) cmd = "rm -f %s" %file_full_name execute_cmd(cmd) return True except Exception, e: LOG.error(e)
def delete_god_conf(procname): try: god_dir = CONF.get("god", "etc_dir") if not god_dir: god_dir = CONF_GOD_ETC_DIR filename = procname + ".god" file_full_name = os.path.join(god_dir, filename) cmd = "rm -f %s" % file_full_name execute_cmd(cmd) return True except Exception, e: LOG.error(e)
def get_status(): try: cmd = "/usr/local/bin/god status" result = execute_cmd(cmd) status = parse_data(result) return status except Exception, e: LOG.error(e)
def god_reload_conf(filename): try: cmd = "/usr/local/bin/god load %s" % filename execute_cmd(cmd) except Exception, e: LOG.error(e)
def god_reload_conf(filename): try: cmd = "/usr/local/bin/god load %s" %filename execute_cmd(cmd) except Exception, e: LOG.error(e)