help-cfengine
[Top][All Lists]
Advanced

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

Re: Defining a Class based on ShellCommand Output or No Output


From: Brian E. Seppanen
Subject: Re: Defining a Class based on ShellCommand Output or No Output
Date: Fri, 5 Aug 2005 11:48:40 -0400 (EDT)

On Thu, 4 Aug 2005, Ed Brown wrote:

This uses ReturnsZero, but not a secondary script.  Also, it was tested
on linux.  Would something like this work for you:

classes:
 SmcOn = ( ReturnsZero(/bin/sh -c "netstat -ln |grep -q 898") )


Thanks for the additional syntax hints. On solaris I ended up having to use
 smcstop = ( ReturnsZero(/usr/xpg4/bin/sh -c "/usr/bin/netstat -an | 
/usr/xpg4/bin/grep -q 898")

before it would work...

Somewhat offtopic, but would anyone mind giving a brief synopsis of what the /usr/xpg4 stuff is?

I didn't realize I was going to have to initiate it's own shell to accomplish it, but I got a bunch of errors without initiating /usr/xpg4/bin/sh.

I tried ( ReturnsZero(/usr/bin/netstat -an | /usr/xpg4/bin/grep -q 898) )
and got invalid argument arguments for netstat

I tried it with single quotes and double ( ReturnsZero('/usr/bin/netstat -an | /usr/xpg4/bin/grep -q 898') )
( ReturnsZero("/usr/bin/netstat -an | /usr/xpg4/bin/grep -q 898")  )

cf:cfengine::/var/cfengine/os/solaris/cf.solaris:18: ExecResult(/command) must specify an absolute path


The good news is it works now.  Thanks for the help.

Brian Seppanen
608.826.1464




reply via email to

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