help-cfengine
[Top][All Lists]
Advanced

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

Re: Strange behaviour with iteration with shellcommands


From: DRANSUTAVICIUS, CLAUDIO
Subject: Re: Strange behaviour with iteration with shellcommands
Date: Tue, 01 Jun 2004 16:04:30 -0400

Thank you very much . That did the trick.
Like you said it is not pretty but it works.

Claudio Dransutavicius

Brendan Strejcek wrote:

> Not the prettiest thing in the world, but this works:
>
> $ cat double_iter.cf
> #!/usr/sbin/cfagent -qIKf
>
> control:
>
>     actionsequence = ( shellcommands )
>
>     users = ( "user1:user2" )
>     source = ( /tmp/source )
>     target = ( /tmp/target )
>
> shellcommands:
>
>     "/bin/sh -c '
>         VAR=${users}
>         /bin/cp ${source}/${dollar}VAR/junk ${target}/${dollar}VAR/junk
>         '
>     "
> $ find /tmp/{source,target} -type f | xargs md5sum
> c3d2d686d0772358e0ff6689873df041  /tmp/source/user1/junk
> fef1e0732d6b040c549ee00bf0969930  /tmp/source/user2/junk
> $ ./double_iter.cf
> cfengine:: Executing script /bin/sh -c '
>         VAR=user1
>         /bin/cp /tmp/source/$VAR/junk /tmp/target/$VAR/junk
>         '
>     ...(timeout=0,uid=-1,gid=-1)
> cfengine:: Finished script /bin/sh -c '
>         VAR=user1
>         /bin/cp /tmp/source/$VAR/junk /tmp/target/$VAR/junk
>         '
>
> cfengine:: Executing script /bin/sh -c '
>         VAR=user2
>         /bin/cp /tmp/source/$VAR/junk /tmp/target/$VAR/junk
>         '
>     ...(timeout=0,uid=-1,gid=-1)
> cfengine:: Finished script /bin/sh -c '
>         VAR=user2
>         /bin/cp /tmp/source/$VAR/junk /tmp/target/$VAR/junk
>         '
>
> $ find /tmp/{source,target} -type f | xargs md5sum
> c3d2d686d0772358e0ff6689873df041  /tmp/source/user1/junk
> fef1e0732d6b040c549ee00bf0969930  /tmp/source/user2/junk
> c3d2d686d0772358e0ff6689873df041  /tmp/target/user1/junk
> fef1e0732d6b040c549ee00bf0969930  /tmp/target/user2/junk
> $






reply via email to

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