判断当前服务器mysql是否存活

一个个小方法

判断当前mysql状态

def mysql_status(port=3306):
    """ Check a MySQL instance
    Args:
    port - A port of the MySQL instance
    """
    port = str(port)
    status="ps -ef|grep '%s'|grep -v grep |grep -v python |awk '{print $2,$3}'"%port
    (out, err, ret) = shell_exec(status)
    return out,ret


你可能感兴趣的:(判断当前服务器mysql是否存活)