Exemplo n.º 1
0
def action_restart(procname):
    try:
        cmd = "/usr/local/bin/god restart %s" %procname
        execute_cmd(cmd)
        return True
    except Exception, e:
        LOG.error(e)
Exemplo n.º 2
0
def action_unmonitor(procname):
    try:
        cmd = "/usr/local/bin/god unmonitor %s" %procname
        execute_cmd(cmd)
        return True
    except Exception, e:
        LOG.error(e)
Exemplo n.º 3
0
def action_unmonitor(procname):
    try:
        cmd = "/usr/local/bin/god unmonitor %s" % procname
        execute_cmd(cmd)
        return True
    except Exception, e:
        LOG.error(e)
Exemplo n.º 4
0
def action_restart(procname):
    try:
        cmd = "/usr/local/bin/god restart %s" % procname
        execute_cmd(cmd)
        return True
    except Exception, e:
        LOG.error(e)
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
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)
Exemplo n.º 7
0
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
Exemplo n.º 8
0
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)
Exemplo n.º 9
0
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)
Exemplo n.º 10
0
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)
Exemplo n.º 11
0
def god_reload_conf(filename):
    try:
        cmd = "/usr/local/bin/god load %s" % filename
        execute_cmd(cmd)
    except Exception, e:
        LOG.error(e)
Exemplo n.º 12
0
def god_reload_conf(filename):
    try:
        cmd = "/usr/local/bin/god load %s" %filename
        execute_cmd(cmd)
    except Exception, e:
        LOG.error(e)