crontab library

Guilherme Polo ggpolo at gmail.com
Wed Oct 24 16:31:16 EDT 2007


2007/10/24, Martin Marcher <martin at marcher.name>:
> 2007/10/24, Guilherme Polo <ggpolo at gmail.com>:
> > 2007/10/24, Martin Marcher <martin at marcher.name>:
> > > I had a look at the crontab docs and never realized how complex it
> > > actually is. So before I spend time in creating such a thing maybe
> > > someone did it already :)
> > >
> >
> > When you say complex, are you talking about the possible ways to
> > define when your job runs ? You could use a parser for the time format
> > it uses, like this:
> > http://umit.svn.sourceforge.net/viewvc/umit/branch/ggpolo/umitCore/CronParser.py?revision=1175&view=markup
>
> This looks nice for starters. But the crontab(5) manpage has a lot
> more - that's what I meant by complex. I guess it's just quite some
> typing work :)
>
>  * lists
>   * 1,2,4
>  * ranges
>   * 1-3
>  * steps
>   * 1-12/2
>   * "*/3"

It supports all these, so your "complex" argument was cut down again.

>  * specials
>   * @annually
>   * @weekly
>   * @daily
>   * ...

These specials aren't really complex, it is just some pre-sets

>  * mixes there of
>   * 1-4,6,16-22/3

Supports too, complexity is over again

>     (this actually depends on which cron you use, the
>     lowest common denominator would be to use either lists or ranges
>     (or ranges with steps))
>
> Then there is the difference of roots crontab where whe have a line
> like this:
>
> # minute hour dom month dow user command
> 0 * * * * nobody echo foo
>
> A users crontab
> # minute hour dom month dow command
> 0 * * * * echo foo
>

For this you basically check how many fields it has, so you can
determine if there is an user especified or not.

> and all the variables one could use. with a few of them being
> mandatory (LOGNAME, or USER depending on the OS), some of them being
> standard variables (SHELL,
> PATH) and of course custom variables.
>

If you need to use these you should know how to use these, just write
them and let the crontab app handle it.

>
> --
> http://noneisyours.marcher.name
> http://feeds.feedburner.com/NoneIsYours
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
-- Guilherme H. Polo Goncalves



More information about the Python-list mailing list