You are here: Forums Ask a Rails expert how to execute the url from my...
Posted in Forums : Ask a Rails expert
Authority 0
Posting Rating 16
Sign in to rate this post
|
My code is as follows if i am not understanding through this code ,then the requirement is like 1:- i have this url:-”(‘http://localhost:3006/bot/index’)”. i want to How can i do that. using rufus-scheduler.because i can not able to setup background.rb in my system.my configuration is:- ruby1.8.6,rails 1.2.3,radrails 1.7.0 please help me in this regard. |
Authority 37
Posting Rating 100
Sign in to rate this post
|
I’m not familiar with Rufus:Scheduler. Is it possible for you to set up a cronjob? If yes, I’d suggest setting up a cronjob according to your needs (i.e. running every 10 minutes) that uses curl, wget or whatever to open the URL. I should probably mention, though, that you shouldn’t have require statements inside method definitions. Put them at the start of the file like this:
require 'rufus/scheduler'
class MyClass < ApplicationController
def schedule
# ... whatever
end
end
PS: pre tags might make your code more readable (like mine). Just use <.pre>code</.pre> (without the periods) around your code. |
Authority 0
Posting Rating 16
Sign in to rate this post
|
Hi Clemens, How i setup cronjob. Is there any Particular gem for this. Would i do it using rufus-scheduler or else to do it any other way. please guide me in this regard. Note:I am working on windows environment.(win-xp)
|
Authority 12
Posting Rating 95
Sign in to rate this post
|
Try scheduling it using windows scheduler Go to control panel -> double click on Scheduled Tasks icon Then click on Add scheduled Task Here you can provide the path of the script you want to run and also schedule it to run according to your requirement. |
Authority 12
Posting Rating 96
Sign in to rate this post
|
Please repost your code again, formatted properly. I’ve never used Rufus::Scheduler but the docs indicate that it can call a method periodically. Look at http://rufus.rubyforge.org/rufus-scheduler/classes/Rufus/Scheduler.html, heading “Cron up to the second”. No need to browse to a URL of your app periodically when you can just execute the code directly. |
Authority 0
Posting Rating 16
Sign in to rate this post
|
Now it is solved. i just call the http object from another method inside the schedule_every ā10sā do *(htttp.get(url)) end .and it works fine. |
Ask a Rails expert : First post, requesting sage perspective
Ask a Rails expert : How to use mephisto
Ask a Rails expert : How to use mephisto
Ask a Rails expert : will_paginate customization problem
Ask a Rails expert : BackgroundRB still wants 'development' environment...?
Ask a Rails expert : activescaffold, sql exception
Ask a Rails expert : Passing non-english chars in query string
Ask a Rails expert : Rails and 2D barcodes
Ask a Rails expert : apache giving proxy error
Ask a Rails expert : Custom Responses w/ 'extra' information...?