Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #84184
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.026 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'python3': 0.07; '22,': 0.09; 'pretend': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'jan': 0.12; 'command.': 0.16; 'confuse': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'maliciously': 0.16; 'module?': 0.16; 'protecting': 0.16; 'script,': 0.16; 'wrote:': 0.18; 'thu,': 0.19; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'decide': 0.24; 'server.': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'that.': 0.31; 'linux': 0.33; 'running': 0.33; 'skip:s 30': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'false': 0.36; 'subject:?': 0.36; 'list': 0.37; 'clear': 0.37; 'server': 0.38; 'jason': 0.38; 'pm,': 0.38; 'expect': 0.39; 'itself': 0.39; 'how': 0.40; 'more': 0.64; 'worth': 0.66; '(probably': 0.84; '2014,': 0.84; '2015': 0.84; 'bailey': 0.84; 'dhcp': 0.84; 'hassle': 0.84; 'to:none': 0.92; 'subject:Check': 0.95 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=/mol2OKnXTVB99nV203r+RHkzOZBqKHWU+LP/1hi9QQ=; b=QKkAldp9eMu/arm8Xz4gcFp5Z+PKtQu8o+4A4RnYBuYHEkD3vCINLOpe887KOlbwA9 aoTxy+/S3GyEHMpoR2It2pUAsDeLZ+9HtJQ/Rn/5B33dAyMXWdsDQM+QmacEBcK8OoAE oAUsYyAMioOcaQRkSCHrxnNFJx7IUfYJdaeX85oRSQ7k9eTtM3D42slaDSOS8ILFd40w FxclirViurA0FPeJqvWd2ks4oiK6XagFCcq0XYqXrawQmkUR7i+hKko1f+jF6Qg4gd7e L5AvsJZkgKix4lLApplj8dM9Yeq8ikMspEKcHhjpSvESS9ZxXj1DOVDSMCuWJ1EqF508 +3ww== |
| MIME-Version | 1.0 |
| X-Received | by 10.140.90.112 with SMTP id w103mr59490372qgd.65.1421901588943; Wed, 21 Jan 2015 20:39:48 -0800 (PST) |
| In-Reply-To | <1e1a7b4bdcf1408799b7f95b5d24851a@ETEXCH2.corp.emerytelcom.com> |
| References | <54C030E9.8010404@emerytelcom.com> <CAGGBd_rbL21MZEh+6PoUYoM-OS-Mpd=sUpSTPiTGhwqJSrqNMw@mail.gmail.com> <1e1a7b4bdcf1408799b7f95b5d24851a@ETEXCH2.corp.emerytelcom.com> |
| Date | Thu, 22 Jan 2015 15:39:48 +1100 |
| Subject | Re: Check for running DHCP daemon? |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17945.1421901591.18130.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1421901591 news.xs4all.nl 2911 [2001:888:2000:d::a6]:37923 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:84184 |
Show key headers only | View raw
On Thu, Jan 22, 2015 at 2:58 PM, Jason Bailey <JBailey@emerytelcom.com> wrote: > How would I get a list of running processes with the subprocess module? The > documentation wasn't clear to me. Using the ps command. :) rosuav@dewey:~$ python3 Python 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import subprocess >>> b" dhcpd\n" in subprocess.check_output(["ps","-A"]) False rosuav@sikorsky:~$ python3 Python 3.5.0a0 (default:4709290253e3, Jan 20 2015, 21:48:07) [GCC 4.7.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import subprocess >>> b" dhcpd\n" in subprocess.check_output(["ps","-A"]) True There's a DHCP server running on Sikorsky, but not on Dewey. :) Of course, this can be faked. Any process can call itself 'dhcpd' and pretend to be the DHCP server. It's up to you to decide how to deal with that. (Probably by not caring, I would expect. Unless you actually expect someone to maliciously try to confuse your script, it's not worth the hassle of protecting yourself.) ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Check for running DHCP daemon? Chris Angelico <rosuav@gmail.com> - 2015-01-22 15:39 +1100
csiph-web