Cron validator

392 views
Skip to first unread message

Aimee Barciauskas

unread,
Sep 27, 2012, 10:00:40 PM9/27/12
to boston-r...@googlegroups.com
Hi all,

Has anyone used a cron syntax validator gem such as https://github.com/bkr/crontab_syntax_checker? If yes, which and would you recommend it or recommend writing my own validation methods?

Thanks,
Aimee

Joe Grossberg

unread,
Sep 28, 2012, 12:09:07 PM9/28/12
to boston-r...@googlegroups.com
Backing up a bit ... 

If your cron jobs are complex enough that they need validation, perhaps you should investigate solving the problem with tools that are more flexible and written in ruby. Are you wedded to that particular solution? (If so, this free RailsCast about a tool called Whatever may be helpful: http://railscasts.com/episodes/164-cron-in-ruby )

I used crontab for years, but there are better options out there if you're doing something more subtle than rotating logs or the like. I think you will be happy with some of the crontab alternatives that now exist.

Joe

Andrew Kuklewicz

unread,
Sep 28, 2012, 12:19:23 PM9/28/12
to boston-r...@googlegroups.com
Could you explain why you need a user to enter a cron expression?

There are more natural ways in ruby to deal with recurring events - I like ice cube:

If this is about scheduling, there are many options, here is a good place to see them - I like whenever and rufus, depending on what you are doing - the resque scheduler makes alot of sense if you already use resque:

If you just want to deal with cron expressions, rufus-scheduler implements 'cronline', and can not only parse them, but tell you when they will next run:

Cheers,

Andrew Kuklewicz


--
 
 

Aimee Barciauskas

unread,
Sep 28, 2012, 12:30:55 PM9/28/12
to boston-r...@googlegroups.com
Thanks, I think cronline is what we are looking for we just need to integrate into the application. We are already using rufus-scheduler for the scheduler module.

At the moment, the crons are not set in the application itself, the application is for dynamically scheduling various jobs, so there is an interface for creating configurations for tasks and the cron expression itself is something that can be constantly updated. The just takes the cron expression as a string from the user and at the moment there is no immediate validation or feedback on the application's evaluation of the cron expression.

Thanks for your help!
Aimee

--
 
 

Reply all
Reply to author
Forward
0 new messages