gnu.cfengine.help
[Top] [All Lists]

Re: Problems with ExecResult & ReturnsZero in 2.1.18

Subject: Re: Problems with ExecResult & ReturnsZero in 2.1.18
From: Mark Burgess
Date: Thu, 29 Dec 2005 08:51:33 +0100
Newsgroups: gnu.cfengine.help
This works:

HomePart = ( ReturnsZero("/bin/sh -c \"df -l | grep \'^/dev\' | awk
\'{print $NF}\' | grep -q \'^/home$\'\"") )

VarPart = ( ReturnsZero(/bin/sh -c "df -l | grep '^/dev' | awk '{print
$NF}' | grep -q '^/var$'") )
 
BootPart = ( ReturnsZero(/bin/sh -c "df -l | grep '^/dev' | awk '{print
$NF}' | grep -q '^/boot$'") )

It yields:

enterprise$ ./cfagent -f ./cftest -p
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda6             28573840   9946040  18627800  35% /
tmpfs                   517792         0    517792   0% /dev/shm
/dev/hda1             24648696  12643940  12004756  52% /windows/C
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda6             28573840   9946040  18627800  35% /
tmpfs                   517792         0    517792   0% /dev/shm
/dev/hda1             24648696  12643940  12004756  52% /windows/C

for 2.1.18

On Wed, 2005-12-28 at 19:31 -0800, Brandon Evans wrote:
> 
> I just upgraded to cfengine 2.1.18 for 2.1.15.  I am now having problems 
> with ExecResult and ReturnsZero.
> 
> First off, ReturnsZero is now spitting out the results of some commands 
> where it didnt before.
> 
> To check for diffirent partations I use the bellow commands:
> 
> HomePart = ( ReturnsZero(/bin/sh -c "df -l | grep '^/dev' | awk '{print 
> $NF}' | grep -q '^/home$'") )
>   VarPart = ( ReturnsZero(/bin/sh -c "df -l | grep '^/dev' | awk '{print 
> $NF}' | grep -q '^/var$'") )
>   BootPart = ( ReturnsZero(/bin/sh -c "df -l | grep '^/dev' | awk 
> '{print $NF}' | grep -q '^/boot$'") )
> 
> 
> Running cfagent from the command line produces the following output:
> 
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/md1              10080428   4525756   5042608  48% /
> /dev/md2                101018      8702     87100  10% /boot
> /dev/md0             106950584  34919112  66598700  35% /home
> none                   1034088         0   1034088   0% /dev/shm
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/md1              10080428   4525756   5042608  48% /
> /dev/md2                101018      8702     87100  10% /boot
> /dev/md0             106950584  34919112  66598700  35% /home
> none                   1034088         0   1034088   0% /dev/shm
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/md1              10080428   4525756   5042608  48% /
> /dev/md2                101018      8702     87100  10% /boot
> /dev/md0             106950584  34919112  66598700  35% /home
> none                   1034088         0   1034088   0% /dev/shm
> 
> 
> I know others have been having problems with pipes 
> (http://www.mail-archive.com/help-cfengine@xxxxxxx/msg01816.html)
> but no quoting I try works.  What changed from 2.1.15 to 2.1.18?  I can 
> no longer use ReturnsZero.  ExecResult and ExecShellResult don't seem to 
> be working either.
> 
> Can someone post a working Example of any of these commands that works 
> with 2.1.18?
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 




<Prev in Thread] Current Thread [Next in Thread>