3

https://github.com/jmettraux/rufus-scheduler states that:

rufus-scheduler is a Ruby gem for scheduling pieces of code (jobs). It understands running a job AT a certain time, IN a certain time, EVERY x time or simply via a CRON statement.

rufus-scheduler is no replacement for cron/at since it runs inside of Ruby.

so what if it runs inside ruby? can't i access cron using the system command in ruby?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
corroded
  • 21,406
  • 19
  • 83
  • 132
  • You can access cron, but you probably mean `crontab`, which is used to view and edit cron tables. There's also `at` and `batch` available on Mac OS and Linux which you could access from Ruby via `system` or `%x{}` too, which are useful for setting one-off jobs occurring at a certain time, a given offset, or when system load permits. – the Tin Man Mar 30 '11 at 05:58
  • i meant for scheduling jobs. can't cron do all that? rufus even has a method for cron, right? – corroded Mar 30 '11 at 05:59
  • I think rufus-scheduler is for those people who aren't comfortable using crontab, at or batch. Cron does repeating/periodic jobs. At and batch are for one-time jobs because those two commands don't support automatically repeating commands. So rufus-scheduler is wrapping the other commands, but if you're comfortable at the command-line and the other commands, it doesn't buy you much in my opinion. – the Tin Man Mar 30 '11 at 06:04
  • i see i see thanks then. if you could give that as an answer i can accept that :) – corroded Mar 30 '11 at 06:05

2 Answers2

11

rufus-scheduler is a "in-ruby-process" scheduler. It is not meant as a cron/at replacement at all.

rufus-scheduler was not meant for people not comfortable with cron/at on the command line, it was meant for people willing to schedule stuff directly inside their ruby process (and understanding what it implies).

If rufus-scheduler was meant as a replacement for cron/at, it would provide some kind of persistence for the jobs, but it does not.

Another take on that : http://adam.heroku.com/past/2010/6/30/replace_cron_with_clockwork/

jmettraux
  • 3,511
  • 3
  • 31
  • 30
3

I think rufus-scheduler is for those people who aren't comfortable using the system's crontab, at or batch.

cron does repeating/periodic jobs and at and batch are for one-time jobs because those two commands don't support automatically repeating commands.

So rufus-scheduler is creating the functionality of the other commands, but if you're comfortable at the command-line and with the other commands, it doesn't buy you much in my opinion.

I haven't used it, but did look through the source, and my concern is that it appears rufus-scheduler relies on threads, which mean Ruby will keep your app running in the background, waiting for the appropriate time or interval to run. If the process gets killed, or the machine restarts it looks like the job won't run, which is a major difference compared to the system's commands which will persist across reboots or the app not being in memory.

We use cron a lot at work for jobs; It's an industry standard tool, and every Linux and Mac computer is running cron-scheduled jobs all through the day, though most users don't know it.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303