[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Defining a Class based on ShellCommand Output or No Output
From: |
Ed Brown |
Subject: |
Re: Defining a Class based on ShellCommand Output or No Output |
Date: |
Fri, 05 Aug 2005 12:41:16 -0600 |
On Fri, 2005-08-05 at 11:45, Brian E. Seppanen wrote:
> If I run that on the command line it doesn't work,
I hope you meant to say it DOES work from the commandline, else why
would you expect it to work in a script, unless I misunderstand you.
But doing a 'netstat -an' and grepping for 898 could be matching other
places, that's why I used '-ln' in my suggestion, which, on linux
anyway, only shows 'LISTEN'ing ports, not every connection and open
socket under the sun. Also, I would try it without the qualifying
"any::".
Try without the '-q' if you want to actually see what's being matched.
-Ed
> To track my logic I have the following
> classes:
> any::
> smcstop = ( ReturnsZero(/usr/xpg4/bin/sh -c "/usr/bin/netstat
> -an | /usr/xpg4/bin/grep -q 898") )
>
> then
> shellcommands:
> smcstop::
> "/etc/init.d/init.wbem stop"
>
>
>
> So grep will return 0 if port 898 is open, which means that smc is running
> and that it needs to be stopped.
>
> If smc isn't running it will return 1, and the class should not be
> defined.
>
>
> Anyone have any ideas.
> Thanks,
>
>
> Brian Seppanen
> 608.826.1464
>
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-cfengine