{"id":127846,"date":"2020-06-10T12:55:34","date_gmt":"2020-06-10T04:55:34","guid":{"rendered":"http:\/\/4563.org\/?p=127846"},"modified":"2020-06-10T12:55:34","modified_gmt":"2020-06-10T04:55:34","slug":"python-shell-%e4%ba%a4%e4%ba%92%e8%bf%94%e5%9b%9e%e7%bb%93%e6%9e%9c%e8%a2%ab%e6%88%aa%e6%96%ad","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=127846","title":{"rendered":"Python shell \u4ea4\u4e92\u8fd4\u56de\u7ed3\u679c\u88ab\u622a\u65ad"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Python shell \u4ea4\u4e92\u8fd4\u56de\u7ed3\u679c\u88ab\u622a\u65ad               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chenshun00 <\/span>  <span><i><\/i> 63<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4ee3\u7801\u5982\u4e0b:<\/p>\n<pre><code>proc = subprocess.Popen(['ps -ef |grep java |grep -v grep'], stdout=subprocess.PIPE, shell=True) proc.communicate() retcode = proc.returncode <\/code><\/pre>\n<p>\u8fd4\u56de\u7ed3\u679c<\/p>\n<pre><code>root      1494     1  0 12 \u6708 05 ?      00:04:51 java -jar -Dxxx=xx -Dxxx1=xx -Dxxx2=xx -Dxxx3=xx -Dxxx4=xx -Dxxx4222d <\/code><\/pre>\n<p>\u9884\u671f\u5728 bash \u4e0a\u6267\u884c\u7ed3\u679c\u5982\u4e0b<\/p>\n<pre><code>[[email&#160;protected] ~]# ps -ef |grep java |grep -v grep root      1494     1  0 12 \u6708 05 ?      00:04:51 java -jar -Dxxx=xx -Dxxx1=xx -Dxxx2=xx -Dxxx3=xx -Dxxx4=xx -Dxxx4222dsdfsdfsdfsdfsfdsfsdfsdfsdfsdfsdfsdfsdf=1 -Dxxx4222dsdfsdfsdfsdfsfdsfsdfsdfsdfsdfsdfsdfsdfx=1 -Dxxx4222dsdfsdfsdfsdfsfdsfsdfsdfsdfsdfsdfsdfsdt=1 -Dxxx4222dsdfsdfsdfsdfsfdsfsdfsdfsdfsdfsdfsdfsdfh=2 demo-0.0.1-SNAPSHOT.jar <\/code><\/pre>\n<p>\u8bf7\u95ee\u4e0b\u8fd9\u4e2a\u662f\u4ec0\u4e48\u95ee\u9898\u5bfc\u81f4\u7684 :\uff09<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>4<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"33209\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : keakon <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6539\u6210 ps -efww                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"33210\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : chenshun00 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @keakon \u56e0\u7f3a\u65af\u6c40 \uff0c \u8fd9\u4e2a\u786e\u5b9e\u53ef\u4ee5\uff0c\u8bf7\u95ee\u4e0b\u8fd9\u4e2a\u662f\u7531\u4e8e\u4ec0\u4e48\u539f\u56e0 \ud83d\ude42                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"33211\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : keakon <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             -w Wide output. Use this option twice for unlimited width.<\/p>\n<p>If ps can not determine display width, as when output is redirected (piped) into a file or another command, the output width is undefined (it may be 80, unlimited, determined by the TERM variable, and so on). The COLUMNS environment variable or &#8211;cols option may be used to exactly determine the width in this case. The w or -w option may be also be used to adjust width.                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"33212\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : matepi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             bash \u6709.profile \u7b49\u73af\u5883\u52a0\u8f7d<br \/>\u7136\u540e\u975e\u4ea4\u4e92\u5f0f shell \u548c\u4ea4\u4e92\u5f0f shell \u4e86\u89e3\u4e00\u4e0b\uff0c\u7f16\u7a0b\u5f00\u53d1\u7684\u975e\u4ea4\u4e92\u5f0f\u4e0d\u52a0\u8f7d\u73af\u5883                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Python shell \u4ea4\u4e92\u8fd4\u56de&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/127846"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=127846"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/127846\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=127846"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=127846"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=127846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}