If I understand your question you want to use the exec resource and
specify the onlyif (or unless) parameter.

Sort of like:

exec {
    "cp /tmp/file1 /data",
    path => [ "/bin" ],
    onlyif => "/usr/bin/my_harmless_binary";
}

On Jan 31, 2:12 pm, Ashley Gould <ago...@ucop.edu> wrote:
> Hi all,
>
> My first post.  I am just getting started with puppet and have made
> good progress with some basics using templates and files.
>
> I would like to perform and an action based on whether or not a
> particular system binary executes successfully, but I don't see an
> obvious way to set puppet conditionals based on an exit value of an
> arbitrary command.  Is there a well known recipe that does something
> like this shell snippet?:
>
> if [ "/usr/bin/my_harmless_binary 2>&1 >/dev/null" ]; then
>   echo "my_harmless_binary succeeded"
>   cp /tmp/file1 /data/
> else
>   echo "my_harmless_binary FAILED"
> fi
>
> --
>
> -ashley
>
> Did you try poking at it with a stick?

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to