help-cfengine
[Top][All Lists]
Advanced

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

shellcommands returns 256, not 0


From: David Kewley
Subject: shellcommands returns 256, not 0
Date: Mon, 19 Apr 2004 13:07:53 -0700
User-agent: KMail/1.5

I can probably find a hack to work around this, but I wonder if anyone else 
has seen this and can suggest a clean solution?

I'm running cfengine on RHL 9.  I am running a pair of shellcommands like 
this:

shellcommands:

        work::

                "/usr/bin/test -d $(host_keys_master_dir)"

                        owner=$(private_owner)
                        group=$(private_group)
                        inform=false
                        useshell=true
                        define=have_host_keys_master

        work.have_host_keys_master::

                "/usr/bin/diff -qr $(host_keys_master_dir) $(host_keys_workdir) 
&& /bin/cp 
-a $(host_keys_master_dir)/* $(host_keys_workdir)"

                        owner=$(private_owner)
                        group=$(private_group)
                        useshell=true

The reason I'm doing a shellcommands 'cp' instead of a copy: is that I need 
the copy to be done as a non-root user, but cfengine is run as root.

Anyway, the problem I'm now seeing is that although the first shellcommand 
(/usr/bin/test) gives a return value of 0 when run in bash, it returns 256 
when run by cfengine.  cfengine interprets this as a failure (non-zero), so 
does not do the 'define', and the second shellcommand is not executed.

I've seen this before and found a way to work around it, but it was a hack.  
Does anyone know how to deal with this cleanly?  Is this a bug somewhere, or 
expected behavior?  What does return code 256 indicate?

Thanks,
David




reply via email to

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