|
从OS上执行命令:
# ps -ef |grep mhas | grep perl | grep -v grep| awk '{print $10}'
--conf=/rdsdata/mhas/b995570c-9155-4967-8700-1390dac6c261/conf/b995570c-9155-4967-8700-1390dac6c261.cnf
--conf=/rdsdata/mhas/6c6b5c16-cbc9-45f6-aad1-3b12406854dc/conf/6c6b5c16-cbc9-45f6-aad1-3b12406854dc.cnf
从python上执行结果不一致:
# python
Python 2.7.5 (default, Aug 4 2017, 00:39:18)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> mha_ps_cmd = 'ps -ef |grep mhas | grep perl | grep -v grep| awk \'{print $10}\''
>>> res = subprocess.Popen(mha_ps_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
>>> print res
('--conf=/rdsdata/mhas/b995570c-9155-4967-8700-\n--conf=/rdsdata/mhas/6c6b5c16-cbc9-45f6-aad1-\n', '')
>>>
为什么呢?
|
|