# Timer for executing events

**URL:** <https://www.ruby-forum.com/t/timer-for-executing-events/61925>\
**Category:** Rails\
**Created:** [May 29, 2006, 9:57pm UTC](https://www.ruby-forum.com/t/timer-for-executing-events/61925 "2006-05-29T21:57:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jtei](https://www.ruby-forum.com/u/jtei)\
**Post date:** [May 29, 2006, 9:57pm UTC](https://www.ruby-forum.com/t/timer-for-executing-events/61925/1 "2006-05-29T21:57:17Z")

</div>

Hi Everyone,

I hope you guys can help me out. What is the best way to go about using  
a timer to execute events? I would like to execute a block of code  
every 24 hours (or at midnight - server time). Is this possible?

What I am trying to get at is that I would like to create a new page  
every 24 hours and have that serve as my front page. Is it possible to  
route to this ‘new page’? Any insights on this on any of this would be  
great!

Thank you in advance for your help!!

---

<div class="post-metadata">

**Author:** ![jtei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jtei](https://www.ruby-forum.com/u/jtei)\
**Post date:** [May 29, 2006, 10:23pm UTC](https://www.ruby-forum.com/t/timer-for-executing-events/61925/2 "2006-05-29T22:23:53Z")

</div>

Jordan I. wrote:

> Hi Everyone,
> 
> I hope you guys can help me out. What is the best way to go about using  
> a timer to execute events? I would like to execute a block of code  
> every 24 hours (or at midnight - server time). Is this possible?
> 
> What I am trying to get at is that I would like to create a new page  
> every 24 hours and have that serve as my front page. Is it possible to  
> route to this ‘new page’? Any insights on this on any of this would be  
> great!
> 
> Thank you in advance for your help!!

Hi Jordan,

See if this helps 🙂  
[http://wiki.rubyonrails.org/rails/pages/HowToRunBackgroundJobsInRails](http://wiki.rubyonrails.org/rails/pages/HowToRunBackgroundJobsInRails)

Victor

---

<div class="post-metadata">

**Author:** ![jtei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jtei](https://www.ruby-forum.com/u/jtei)\
**Post date:** [May 30, 2006, 7:14pm UTC](https://www.ruby-forum.com/t/timer-for-executing-events/61925/3 "2006-05-30T19:14:24Z")

</div>

Hi Victor,

Thanks for the link. Would you happen to know if this would work on my  
local webrick running windows? or do i need to deploy on a linux server?

Thanks for your help.

Jordan

Victor F. wrote:

> Jordan I. wrote:
> 
> > Hi Everyone,
> > 
> > I hope you guys can help me out. What is the best way to go about using  
> > a timer to execute events? I would like to execute a block of code  
> > every 24 hours (or at midnight - server time). Is this possible?
> > 
> > What I am trying to get at is that I would like to create a new page  
> > every 24 hours and have that serve as my front page. Is it possible to  
> > route to this ‘new page’? Any insights on this on any of this would be  
> > great!
> > 
> > Thank you in advance for your help!!
> 
> Hi Jordan,
> 
> See if this helps 🙂  
> [http://wiki.rubyonrails.org/rails/pages/HowToRunBackgroundJobsInRails](http://wiki.rubyonrails.org/rails/pages/HowToRunBackgroundJobsInRails)
> 
> Victor

---

<div class="post-metadata">

**Author:** ![jtei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jtei](https://www.ruby-forum.com/u/jtei)\
**Post date:** [May 30, 2006, 8:30pm UTC](https://www.ruby-forum.com/t/timer-for-executing-events/61925/4 "2006-05-30T20:30:43Z")

</div>

Jordan I. wrote:

> Hi Victor,
> 
> Thanks for the link. Would you happen to know if this would work on my  
> local webrick running windows? or do i need to deploy on a linux server?
> 
> Thanks for your help.
> 
> Jordan

The .script/runner -e production “Model.do\_something” solution should  
work with any scheduler, I presume you can create a new task with the  
Windows XP scheduler and have .script/runner executed when needed

BTW, .script/runner have nothing to do with webrick or any kind of http  
server - It is use to run Rails tasks outside the http server.
