Superman2971
Superman2971

Reputation: 1535

Execute Ruby Cron

I've reviewed several tutorials and other stackoverflow questions on the subject but have been unable to self administer a fix.

After several attempts to institute other solutions, here is my original code that I'm really hoping to get working:

00,30 10-20 * * * ruby  ~/Documents/GeneralAssembly/ForFun/SMS/sms.rb

By the way, the sms.rb is connected to Twillio. I'm setting up the Cron to text me every half hour and remind me not to snack in the middle of the day, :)

The file runs and works by itself, plus I receive mail when the cron attempts to run, but still not working together.

Please help as best you can. Let me know what I am misunderstanding. Thank you very much!

Upvotes: 0

Views: 73

Answers (2)

Patrick Oscity
Patrick Oscity

Reputation: 54724

You can also try to use the whenever gem. It wraps cron jobs in a nice DSL and generates/updates your cron file for you. For example:

# config/schedule.rb

every 10.minutes do
  runner "MyModel.some_process"
  rake "my:rake:task"
  command "/usr/bin/my_great_command"
end

Then test the output with whenever -w and apply it with whenever --update-cronfile

Upvotes: 0

manonthemat
manonthemat

Reputation: 6251

Try including the whole path to ruby

Upvotes: 1

Related Questions