search pid whether exists or not
This commit is contained in:
@ -129,10 +129,11 @@ class Kernel(BaseComponent):
|
||||
raise Exception(ErrorCode.GAUSS_516["GAUSS_51610"] %
|
||||
"instance" + " Error: \n%s." % output)
|
||||
if output.find("No such process") > 0:
|
||||
cmd = "ps c -eo pid,euid,cmd | grep gaussdb | grep -v grep \
|
||||
| awk '{if($2 == curuid && $1!=\"-n\") print \"/proc/\"$1\"/cwd\"}' \
|
||||
curuid=`id -u`| xargs ls -l | awk '{if ($NF==\"%s\") print $(NF-2)}' \
|
||||
| awk -F/ '{print $3 }'" % (self.instInfo.datadir)
|
||||
cmd = "ps c -eo pid,euid,cmd | grep gaussdb | grep -v grep | " \
|
||||
"awk '{if($2 == curuid && $1!=\"-n\") " \
|
||||
"print \"/proc/\"$1\"/cwd\"}' curuid=`id -u`|" \
|
||||
" xargs ls -l |awk '{if ($NF==\"%s\") print $(NF-2)}' | " \
|
||||
"awk -F/ '{print $3 }'" % (self.instInfo.datadir)
|
||||
(status, rightpid) = subprocess.getstatusoutput(cmd)
|
||||
if rightpid or status != 0:
|
||||
GaussLog.exitWithError(output)
|
||||
|
Reference in New Issue
Block a user