Commit 61f9fe56 by Ben Patterson

Merge pull request #4658 from edx/benp/fix-bok-choy-check

bok-choy: check mysql the old way.
parents 1ae59010 e6d6a3bf
...@@ -5,7 +5,6 @@ import sys ...@@ -5,7 +5,6 @@ import sys
import os import os
import time import time
import httplib import httplib
import subprocess
from paver.easy import sh from paver.easy import sh
from pavelib.utils.envs import Env from pavelib.utils.envs import Env
from pavelib.utils.process import run_background_process from pavelib.utils.process import run_background_process
...@@ -126,13 +125,10 @@ def is_mysql_running(): ...@@ -126,13 +125,10 @@ def is_mysql_running():
""" """
Returns True if mysql is running, False otherwise. Returns True if mysql is running, False otherwise.
""" """
# We need to check whether or not mysql is running as a process # We use the MySQL CLI client and capture its stderr
# even if it is not daemonized. # If the client cannot connect successfully, stderr will be non-empty
with open(os.devnull, 'w') as DEVNULL: output = os.popen('status mysql 2>&1').read()
#pgrep returns the PID, which we send to /dev/null return output.startswith("mysql start/running, process")
returncode = subprocess.call("pgrep mysqld", stdout=DEVNULL, shell=True)
return returncode == 0
def clear_mongo(): def clear_mongo():
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment