[augeas-devel] Add lens for cron and associated test

Raphaël Pinson raphink at gmail.com
Fri Apr 10 06:51:33 UTC 2009


2009/4/10 David Lutterkort <lutter at redhat.com>

> On Thu, 2009-04-09 at 08:30 +0200, Raphaël Pinson wrote:
>
>
> > The format is different, because the format in crontab and cron.d
> > specifies the user between the time and command, whereas user crontabs
> > don't need a user specification so it's just time and command.
>
> Of course .. maybe we should just have a lens for that format in Cron,
> but not use it in any transform; people can then easily set up parsing
> of those files through /augeas/load.
>
> > By the way, I was wondering if it couldn't be interesting to add a
> > sublevel for time, like :
> >
> >      { "time"
> >           { "minute" = "*" }
> >           { "hour"     = "*" }
> >           { "dayofmonth" = "*" }
> >           { "month"      = "*" }
> >           { "dayofweek" = "*" } }
>
> Yes, I think that would be a very nice change. Makes perfect sense.
>


OK. Actually, I was thinking about the crontab tree. I don't really like
nodes without a value, they make xpath expressions harder/longer when the
schema could be a bit more condensed. So I've thought of mapping crontabs
like this :


1   2     3    4     5     foo   foobar arg

into


{ "entry" = "foobar arg"
    { "time"
         { "minute" = "1" }
         { "hour" = "2" }
         { "dayofmonth" = "3" }
         { "month" = "4" }
         { "dayofweek" = "5" } }
     { "user" = "foo" } }


and


@yearly  foo foobar arg

into


{ "entry" = "foobar arg"
    { "schedule" = "yearly" }
    { "user"          = "foo" } }



This makes it easier to find crontabs, since I think most admins will agree
that a crontab line is defined mostly by its command.


Ideally, I would even have thought of mapping "schedule" and "time" into the
same node, giving a value to the "schedule" node when it's a schedule like
@yearly, and giving no value but sub-nodes to it when it's a
minute/hour/dom/month/dow time format. Not sure about that though.


For the user crontab, I guess I could make a user_cron.aug which uses
cron.aug's definitions to define it's lens, and doesn't autoload, or
autoloads on "/var/spool/cron/crontabs/*".




Raphaël
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20090410/94588a63/attachment.htm>


More information about the augeas-devel mailing list