[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: files and existance of the file
From: |
Lance Albertson |
Subject: |
Re: files and existance of the file |
Date: |
Mon, 04 Jul 2005 13:35:28 -0500 |
On Sun, 2005-07-03 at 19:52 +0200, Knut Auvor Grythe wrote:
> On Sun, Jul 03, 2005 at 12:30:02PM -0500, Lance Albertson wrote:
> > Currently, I'm wanting to make sure a file in all the home directories
> > is a specific permission. The problem is, the file may not exist so
> > cfengine should just ignore it. When that happens I always get output of
> > it simliar to this:
> >
> > cfengine:host: Directory /home/foouser/.foo cannot be accessed in files
> >
> > Is there a missing option I can use to make this work or is this just
> > the nature of cfengine?
>
> Couldn't you just do it recursively? Something like this:
>
> files:
> any::
> /home/*/.foo
> recurse=1 action=fixall
> m=644
>
> Not sure if recurse should be 1 or 2 (I don't know where it starts
> counting). Haven't tested, and it depends on your directory structure
> for directories anyway. I just googled it and found the example in
> http://cclib.nsu.ru/projects/gnudocs/gnudocs/cfengine/cfengine_35.html
>
> If the recursion isn't what you want, maybe you could do a test in
> groups and use it afterwards? Like this:
>
> groups:
> any::
> foo_exists = ( FileExists(/home/foouser/.foo) )
>
> files:
> foo_exists::
> /home/foouser/.foo
> m=644
>
> That way, the rule in files would only be run on existing files.
>
> Hope this helps. I'm not quite sure what you are doing, so this advice
> might not fit your situation :-)
Actually, I found an even better way to resolve this:
files:
/home mode=0640 owner=root group=foo include=.foo action=fixall
I tested it and didn't get a bunch of emails complaining about not
finding that file.
Cheers,
--
Lance Albertson <ramereth@gentoo.org>
Gentoo Infrastructure | Operations Manager
---
GPG Public Key: <http://www.ramereth.net/lance.asc>
Key fingerprint: 0423 92F3 544A 1282 5AB1 4D07 416F A15D 27F4 B742
ramereth/irc.freenode.net
signature.asc
Description: This is a digitally signed message part