[Grok-dev] spotlight on: z3c.recipe.usercrontab

Wichert Akkerman wichert at wiggy.net
Sun Jan 17 06:07:44 EST 2010


Perhaps it would be useful to post these spotlights on grok.zope.org to 
get some exposure? And perhaps get the syndicated to some planets as 
wel. Only posting them to grok-dev feels a little bit like preaching to 
choir.

Wichert.


On 2010-1-17 11:57, Jan-Wijbrand Kolman wrote:
> Spotlight on...
>
> z3c.recipe.usercrontab[1] is a zc.buildout[2] recipe. With this recipe you can
> define crontab[2] rules that will be installed in the user's crontab. As such it
> is probably only useful on unix-like systems. It has been tested on Linux and
> Mac OS X.
>
> With this recipe it is easy to define recurring actions related to the
> deployment of your application. Examples are: periodically checking the event
> log file for irregularities[4], sending emails from a mail queue, or have cron
> start your application after a system reboot.
>
> The `usercrontab` part in your `buildout.cfg` file could look like this::
>
>    [buildout]
>    ...
>    parts = ...
>            logcheck
>            reboot
>
>    [logcheck]
>    recipe = z3c.recipe.usercrontab
>    times = 39 * * * *
>    command = [cmd]
>
>    [reboot]
>    recipe = z3c.recipe.usercrontab
>    times = @reboot
>    command = ${buildout:directory}/bin/zopectl start
>
> After running ``./bin/buildout` you can inspect the result of the recipe with::
>
>    $ crontab -l
>
> There you will see something like::
>
>    # Generated by /home/jw/projects/sandbox/usercrontab [logcheck]
>    39 * * * *	/home/jw/projects/sandbox/usercrontab/bin/[cmd]
>    # END /home/jw/projects/sandbox/usercrontab [logcheck]
>
>    # Generated by /home/jw/projects/sandbox/usercrontab [reboot]
>    @reboot	/home/jw/projects/sandbox/usercrontab/bin/zopectl start
>    # END /home/jw/projects/sandbox/usercrontab [reboot]
>
> The markers around the actual crontab line are important: z3c.recipe.usercrontab
> will use this markers to see if the buildout part already did its work in order
> to prevent duplicates. The markers are also used to remove these lines from the
> crontab, when uninstalling the part.
>
> The Python Package Index page for z3c.recipe.usercrontab explain the use of the
> `times` and `command` directives in more detail.
>
> [1] http://pypi.python.org/pypi/z3c.recipe.usercrontab
>
> [1] http://www.buildout.org/ and http://pypi.python.org/pypi/zc.buildout
>
> [2] http://en.wikipedia.org/wiki/Cron
>
> [3] for example with: http://pypi.python.org/pypi/tha.logcheck
>
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev


-- 
Wichert Akkerman <wichert at wiggy.net>   It is simple to make things.
http://www.wiggy.net/                  It is hard to make things simple.


More information about the Grok-dev mailing list