Exemplo n.º 1
0
def is_process_running(proc_name, host=None):
    if host is not None:
        cmd = Command(name='pgrep for %s' % proc_name,
                      cmdStr="pgrep %s" % proc_name,
                      ctxt=REMOTE,
                      remoteHost=host)
    else:
        cmd = Command(name='pgrep for %s' % proc_name,
                      cmdStr="pgrep %s" % proc_name)
    cmd.run()
    if cmd.get_return_code() > 1:
        raise Exception("unexpected problem with pgrep, return code: %s" % cmd.get_return_code())
    return cmd.get_return_code() == 0
Exemplo n.º 2
0
Arquivo: utils.py Projeto: pf-qiu/gpdb
def is_process_running(proc_name, host=None):
    if host is not None:
        cmd = Command(name='pgrep for %s' % proc_name,
                      cmdStr="pgrep %s" % proc_name,
                      ctxt=REMOTE,
                      remoteHost=host)
    else:
        cmd = Command(name='pgrep for %s' % proc_name,
                      cmdStr="pgrep %s" % proc_name)
    cmd.run()
    if cmd.get_return_code() > 1:
        raise Exception("unexpected problem with pgrep, return code: %s" % cmd.get_return_code())
    return cmd.get_return_code() == 0
Exemplo n.º 3
0
 def remove_postmaster_pid(self):
     cmd = Command(name='remove the postmaster.pid file',
                   cmdStr='rm -f %s/postmaster.pid' %
                   self.recovery_info.target_datadir)
     cmd.run()
     return_code = cmd.get_return_code()
     if return_code != 0:
         raise ExecutionError(
             "Failed while trying to remove postmaster.pid.", cmd)