[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Determining user ID
From: |
Jason Martin |
Subject: |
Re: Determining user ID |
Date: |
Tue, 20 Dec 2005 22:49:52 -0500 |
User-agent: |
Mutt/1.5.11 |
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.
pgpGxBYVVleGn.pgp
Description: PGP signature