public
Fork of scrooloose/crondle
Description: A dsl for cron
Clone URL: git://github.com/halorgium/crondle.git
halorgium (author)
Tue Apr 08 14:21:04 -0700 2008
commit  7cf985a2b8d88bc4366b08a12fa1d4c0e34e6858
tree    1c1f7f5d0bbdbb7cf87a8bee362cf76d3495f6a3
parent  5e3d615c2e10f0bb0440e90db564c1f5b8d7e446
name age message
file .gitignore Mon Apr 07 00:05:03 -0700 2008 gitignored some stuff [scrooloose]
file README Tue Apr 08 14:21:04 -0700 2008 Shift the define_jobs into the top-level module [halorgium]
directory lib/ Tue Apr 08 14:21:04 -0700 2008 Shift the define_jobs into the top-level module [halorgium]
directory spec/ Tue Apr 08 08:24:03 -0700 2008 Default the timing options if they are not spec... [halorgium]
README
This is a dsl for making crontab code that ive been hacking for fun. Ill probably
make it into a gem at some stage.

Below is an example ruby file that uses crondle.


    require 'lib/crondle'

    Crondle.define_jobs do |builder|

      builder.desc "Restart god every midnight"
      builder.job "/home/admin/bin/god-restart", :minute => 0,
                                                 :hour => 0

      builder.desc "Do an ls at 00:30 on the 5th day of every month"
      builder.job "ls", :minute => 30,
                        :hour => 0,
                        :day_of_month => 5

      builder.desc "Do a foobar every tuesday at midnight"
      builder.job "foobar", :day_of_week => :tuesday,
                        :hour => 0,
                        :minute => 0

      builder.desc "Run rodney at midnight nightly"
      builder.daily_job "rodney"

      builder.desc "Run boner at 3am nightly"
      builder.daily_job "boner", 3
    end


Running ruby on this file would produce the following crontab code


    # Restart god every midnight
    0 0 * * * /home/admin/bin/god-restart

    # Do an ls at 00:30 on the 5th day of every month
    30 0 5 * * ls

    # Do a foobar every tuesday at midnight
    0 0 * * 2 foobar

    # Run rodney at midnight nightly
    0 0 * * * rodney

    # Run boner at 3am nightly
    0 3 * * * boner