Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'bash': 0.09; 'exec': 0.09; 'quarter': 0.09; 'skip:/ 10': 0.09; 'subject:process': 0.09; 'wrapper': 0.09; 'python': 0.11; 'processes.': 0.16; 'true:': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'import': 0.22; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'wondering': 0.29; 'that.': 0.31; 'info.': 0.31; 'stuff': 0.32; 'run': 0.32; 'open': 0.33; 'running': 0.33; "i'd": 0.34; 'but': 0.35; 'possible': 0.36; 'hi,': 0.36; 'so,': 0.37; 'operating': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'such': 0.63; 'account': 0.65; 'received:74.208': 0.68; 'received:74.208.4.194': 0.84; 'rita': 0.84; 'snapshot': 0.84; 'do:': 0.91 Date: Tue, 30 Apr 2013 12:38:44 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: python-list@python.org Subject: Re: python process accounting References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:rqiHWbvFFj9LAbkMkQPMEfttRloP3pa1X4P3mcosYTO 41UF6wv8vfPPZSdCrvF7NIN5s1bvLba/DucN2gjlgU/Hn2s1tj 0XZmg2o210rxec6GULKRCzbw6NzEtLZ4D4+o1xjPz/xTMGfLcv ho1Q5LmR8sKKtMTwpCLfv0dRNXHDtjXyVOzvouVRj3NVogCAGr GPofa7+HqFVJYWEiv92iTMw7ps+dQUbmmeVfZYPS76EbZdRseo evORQ7pF4zOTyUQTeW3/IJibslorRw6lGHkmI+zThF27/sFySm dEC4VzhqkISJVz61ShzX5KXik/+VEPaU1KHRXkjjQpFMh17SA= = X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1367339944 news.xs4all.nl 15930 [2001:888:2000:d::a6]:47046 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44554 On 04/30/2013 12:25 PM, Rita wrote: > Hi, > > I was wondering if it possible to write a python wrapper which will account > my processes. I would like to account for all the children processes (fork) > by looking at their /proc/ info. Such as memory, io, open files, > stats. > > So, instead of me running "/bin/sleep 10", i would like to run it as > "pywrap.py /bin/sleep 10" and it will do an exec /bin/sleep 10 and do a > periodic snapshot for whats in /proc//stats. > > I only understood a quarter of that. But if you want to sleep, why not just call time.sleep ? import os while True: os.sleep(10) ... do some stuff with the processes. If you want help in the other portion, you'd better explain: <<<<<< Running Python xx.xx in Operating System yy. From the bash prompt, I'd like to do: zzzzz, and zzzz And here's what I mean by child processes. Children of the current bash shell? Or what? <<<<<< -- DaveA