Cron

Postmodern edited this page Oct 21, 2013 · 5 revisions

chruby can be used to switch Rubies for specific cron jobs.

Note: chruby-exec must be accessible via PATH, SHELL must be set and chruby must be loaded by the shell.

/etc/crontab

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
MAILTO=root

30 18 * * *   chruby-exec 1.9.3 -- /path/to/script

crontab -e

You can also use chruby in user-specific crontabs:

SHELL=/bin/bash
HOME=/home/deploy
PATH=/bin:/usr/bin:/usr/local/bin

30 18 * * *   chruby-exec 1.9.3 -- /path/to/script