Re: Monitoring CPU usage of a process
On Mon, Jun 03, 2002 at 12:34:21PM +1000, Chris Kenrick wrote:
> You've probably already thought of this, but would a simple shell script
> do the trick...
>
> eg
>
> while [ true ]
> do
Just so you know, that syntax ('[ true ]') actually tests the length of
the string 'true'. While it does always return a true value, this is
cleaner:
while :
do
> ps aux | grep [s]omeprocess >> somelogfile
> sleep 60;
> done
>
>
> Note that the using the square brackets around the first letter of the
> process name is just a neat trick to stop the grep process itself from
> being picked up in the output.
You probably want to quote the argument to grep in case the shell finds
a suitable file in the current directory and decides to expand the
square brackets.
Nitpicking since 1981,
--
Colin Watson [cjwatson@flatline.org.uk]
--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: