Write a module to do that and call it via PrepModule.

-Jason Martin

On Tue, Dec 20, 2005 at 10:12:18PM +0000, Christopher Browne wrote:
> I've got a scenario where I'll need to run a cfengine script as
> various users, and then do different actions based on the user name.
> (No, no, can't use root; that is verboten by Powers That Be...)
> 
> For instance...  I have users pgonedatabaseuser,
> pganotherdatabaseuser, pgyetanotherdatabaseuser.
> 
> I can write a nice tidy tidy section thus:
> 
> tidy:
>   pgonedatabaseuser.onedatabase::
>     /path/to/onedatabase
>        pattern=pg_*.log
>        age=$(pglogage)
> 
>   pganotherdatabaseuser.anotherdatabase::
>     /path/to/anotherdatabase
>        pattern=pg_*.log
>        age=$(pglogage)
> 
>   pgyetanotherdatabaseuser.yetanotherdatabase::
>     /path/to/yetanotherdatabase
>        pattern=pg_*.log
>        age=$(pglogage)
> 
> The trouble, at this point, is creating the
> pgonedatabaseuser/pganotherdatabaseuser/pgyetanotherdatabaseuser
> groups.
> 
> The best guess is something like:
> 
> control:
>    tempusername = ( ExecResult(/usr/bin/whoami) )
> 
> groups:
>    pgonedatabaseuser        = ( StrCmp(${tempusername}, "pgonedatabaseuser"))
>    pganotherdatabaseuser    = ( StrCmp(${tempusername}, 
> "pganotherdatabaseuser"))
>    pgyetanotherdatabaseuser = ( StrCmp(${tempusername}, 
> "pgyetanotherdatabaseuser"))
> 
> But apparently the groups are defined before tempusername gets defined.
> 
> There has got to be some better way that I'm not thinking of...

-- 
I'll have one brain on drugs with bacon, toast and juice.
This message is PGP/MIME signed.

Attachment: pgpu2fQXnpsHa.pgp
Description: PGP signature

_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/help-cfengine

Reply via email to