I am running rails 3 vers开发者_运维问答ion . I need to set crons in the server
I dont want to use wget method in crons. Instead of that need to run the files from the server. I need to run the ROR page through terminal in crons
Is there any way for this
Thanks
You can take a look to the whenever gem:
https://github.com/javan/whenever
Shortly you can call a method in your code doing something like this (as explained on the gem homepage)
every 1.day, :at => '4:30 am' do
runner "MyModel.task_to_run_at_four_thirty_in_the_morning"
end
I got it using Rake
I just created a rake file inside the tasks folder end executed the following command
"cd :path && script/rails runner -e :environment ':task' :output"
精彩评论