help-cfengine
[Top][All Lists]
Advanced

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

Re: help!! - cfservd stops responding after several hours [OT]


From: Russell Adams
Subject: Re: help!! - cfservd stops responding after several hours [OT]
Date: Wed, 4 Aug 2004 09:48:48 -0500
User-agent: Mutt/1.4.2.1i

The brackets indicate a specific list of characters to match, even if
its just one.

For instance:

    ps auwx | grep [Eax]term

would match any of Eterm, aterm, or xterm.

The key is that when you grep the process list for a specific process,
you tend to match your own grep process.

When you use the brackets, grep uses the contents inside the brackets
in the pattern (not the brackets themselves), and then it doesn't
match the brackets in the process listing for grep.

This is just an easy method to prevent using a later 'grep -v grep' to
get rid of any grep processes that were matched.

Examples:

Normal w/ extra matching grep process:

rladams@soja rladams $ ps ax | grep cfexec
21744 ?        S      0:00 /var/cfengine/bin/cfexecd -g
 3596 pts/2    S      0:00 grep cfexec


Extra grep to get rid of grep process:

rladams@soja rladams $ ps ax | grep cfexec | grep -v grep
21744 ?        S      0:00 /var/cfengine/bin/cfexecd -g


Or just use a smart regexp to prevent matching the grep process:

rladams@soja rladams $ ps ax | grep [c]fexec         
21744 ?        S      0:00 /var/cfengine/bin/cfexecd -g

Russell


On Wed, Aug 04, 2004 at 05:58:30AM -0700, Sigurd Trygg wrote:
> > Off topic tip, try using:
> > 
> >     ps auxw | grep [c]fservd
> 
> Hey, I always wanted to do that!  Reading the man grep (GNU grep
> 2.5.1, Linux 2.4, i686), however, I don't understand [how|why] it
> works.  I thought "grep abc" and "grep [a]bc" were equal.  May I ask
> for an explanation please?
> 
> s.
> --
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-cfengine




reply via email to

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