简体   繁体   中英

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!

尝试包括整个通往红宝石的道路

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM