processi

about processes and engines

cron schedule, to the second

The venerable cron unix utility allows for schedule up to the minute.

The OpenWFEru scheduler schedule method mimicks it for the Ruby platform, so until now, it went up to the minute as well. I felt it was sufficient, but of course, someone asked for schedules up to the second.

So here we go :

require 'rubygems'
require 'openwfe/util/scheduler'

scheduler = OpenWFE::Scheduler.new
scheduler.start

scheduler.schedule "7,27,30 * * * * 1-5" do

    puts "the second is now 7, 27 or 30"
    puts "and it's not Sunday or Caturday..."
end

The OpenWFEru scheduler is available as a gem from the OpenWFEru download page, or via the usual sudo gem install openwferu-scheduler.

The OpenWFEru scheduler documentation is available as well.

(seems like Syntax Highlighted content input works better from Safari, Firefox seemed to get in the way… Weird…)

Written by John Mettraux

October 18, 2007 at 11:37 pm

Posted in ruby, scheduling

3 Responses

Subscribe to comments with RSS.

  1. upto the second, but the ruby startup overhead is around 4-5 seconds..

    WTH is wrong with you people?

    George I. Joe

    October 19, 2007 at 1:18 am

  2. Seems like you don’t get the use case.

    Cheers,

    John

    John Mettraux

    October 19, 2007 at 1:25 am

  3. $ time ruby -e “puts ‘hello'”
    hello

    real 0m0.004s
    user 0m0.003s
    sys 0m0.001s

    anyway

    John Mettraux

    October 19, 2007 at 1:31 am


Comments are closed.

%d bloggers like this: