help-cfengine
[Top][All Lists]
Advanced

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

Re: defining classes based on returning results of (shell) commands?


From: David E. Nelson
Subject: Re: defining classes based on returning results of (shell) commands?
Date: Wed, 23 Aug 2006 19:40:17 -0500 (CDT)


Hi Robinson,

How about leveraging 'egrep'? For example, I use something like the following in my 'groups:' section:

WrongOptLocal = ( ReturnsZero(/bin/sh -c "PATH=/bin:/usr/bin:/sbin:/usr/sbin ; mount | egrep 'filer:/vol/vol0/opt/local' > /dev/null 2>&1") )

Use regex w/ egrep to get as specific as you want.

And then in 'alerts:' I have:

alerts:

  WrongOptLocal::

    "WARNING: System is mounting /opt/local from the wrong filer"

Regards,
         /\/elson


On Wed, 23 Aug 2006, Robinson Tiemuqinke wrote:

Hi,

If there are any ways to define groups/classes with
the return results of (shell) commands? Currently
there is a function called ReturnZero can be used to
define classes based on exit code, like explained in
the online reference:

ReturnsZero(command)
True if the named shell command returns with exit code
zero (success).

But what I’d like to have is something like the
following:

strCmpReturn(identificationString, command)

        True if the named shell command returns with
(exactly) the identificationString(or number).

If there is already a function like the above? If
not, anyone can suggest another way to workaround it?

Thanks a lot.



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


_______________________________________________
Help-cfengine mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-cfengine


--
~~ ** ~~ Research has shown that Mondays account for 1/7th of your time ~~ ** ~~

reply via email to

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