crontab library

Martin Marcher martin at marcher.name
Wed Oct 24 22:23:55 CEST 2007


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"
 * specials
  * @annually
  * @weekly
  * @daily
  * ...
 * mixes there of
  * 1-4,6,16-22/3
    (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

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.


-- 
http://noneisyours.marcher.name
http://feeds.feedburner.com/NoneIsYours



More information about the Python-list mailing list