crontool
Paste a schedule, read it in English, see the next runs.

Running a Ruby Script with Cron

Use the absolute path to ruby because cron's PATH is minimal. With rbenv or rvm the ruby binary is not where cron looks, so point at it directly or load the version manager first.

The crontab line

0 * * * * /usr/bin/ruby /opt/app/task.rb >> /var/log/ruby-job.log 2>&1

Run which ruby to get the absolute path and paste it in.

With rbenv

rbenv shims aren't on cron's PATH. Use the full shim path or load rbenv: 0 * * * * ~/.rbenv/shims/ruby /opt/app/task.rb.

With rvm and bundler

For a bundled app wrap it: 0 * * * * cd /opt/app && /usr/bin/env bash -lc "bundle exec ruby task.rb". The login shell loads rvm.

FAQ

How do I run a Ruby script from cron?

Use the absolute ruby path: 0 * * * * /usr/bin/ruby /opt/app/task.rb. Find it with which ruby.

Why does cron say ruby command not found?

Cron has a minimal PATH and rbenv/rvm shims are not on it. Use the full path or load the version manager first.

How do I run bundle exec from cron?

cd into the app and use a login shell: bash -lc "bundle exec ruby task.rb" so rvm/rbenv is initialised.