Reputation: 309
I'm trying to run a ruby script that I can run just fine using Ruby from my home directory, but that fails using cron. The beginning of the script autocheck.rb looks like this:
require 'rubygems'
require 'mechanize'
require 'json'
require "active_record"
ActiveRecord::Base.establish_connection(
:adapter => "postgresql",
:encoding => "utf8",
:database => "depot_development",
:pool => "5",
:username => "depot",
:password => "fake_pwd")
The crontab looks like this:
*/15 08-17 * * 1-5 ruby /home/user/autocheck.rb
I checked the other entries here relating to cron and rvm (presuming that's the problem; I'm using rvm and ruby version 1.9.3) but I couldn't figure out the solution. Any help would be appreciated.
Upvotes: 0
Views: 94
Reputation: 53158
RVM has a command to setup schedules for you:
rvm cron command "*/15 08-17 * * 1-5" ruby /home/user/autocheck.rb
Upvotes: 1