[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Killing backticks when bouncing screen.

From: Chris Jones
Subject: Re: Killing backticks when bouncing screen.
Date: Wed, 21 Jan 2009 21:09:05 -0500
User-agent: Mutt/1.5.13 (2006-08-11)

On Tue, Jan 20, 2009 at 08:31:18AM EST, Malte Skoruppa wrote:


> >Thinking I would avoid the overhead of starting new processes,
> >particularly for stuff that requires frequent updates in order to be
> >relevant ..  such as CPU utilization, I thought I'd write scripts
> >that run in the background & iterate for ever over the following:
> >acquire data, format & write to stdout, sleep a while, etc.

> Instead of having your scripts loop infinitely, like yours do, and
> relying on the mentioned behavior of the backtick command when the
> lifespan and autorefresh parameters are zero (that is to say, the last
> line of output is always printed in the hardstatus line or captions,
> wherever you display your information), how about you remove the loops
> in your scripts and have them output the monitoring information only
> *once*?

Sorry if my original post was unclear. 

Some data obviously needs to be updated frequently to be useful.

My intention was to avoid the overhead of having three or four scripts
take off every second or so.


> This results in exactly the same behavior, that is, the output is
> regenereated every 2 seconds, but the script is only run once each
> time and terminated directly, so no script will stay in the
> background, using less CPU power, and your problem is solved.

That's how I do it for data that only needs to be refreshed once in a
while, every minute for mem/swap utilization.. every hour for the
current outdoors temperature...

For CPU & network activity where a one-second refresh interval makes
better sense, I decided that starting a process for each and every
update was totally wasteful.  



reply via email to

[Prev in Thread] Current Thread [Next in Thread]