# Schedule to run a method?

**URL:** <https://www.ruby-forum.com/t/schedule-to-run-a-method/194793>\
**Category:** Rails\
**Created:** [September 10, 2010, 8:04pm UTC](https://www.ruby-forum.com/t/schedule-to-run-a-method/194793 "2010-09-10T20:04:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluegreen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8491ac/32.png) [@bluegreen](https://www.ruby-forum.com/u/bluegreen)\
**Post date:** [September 10, 2010, 8:04pm UTC](https://www.ruby-forum.com/t/schedule-to-run-a-method/194793/1 "2010-09-10T20:04:15Z")

</div>

Hi, everyone. I wrote a ror app. One of the methods in controller  
extracts data from files and saves it to database. Because there are  
many new files every night, is it possible to run this method only every  
night or every other night? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![bluegreen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8491ac/32.png) [@bluegreen](https://www.ruby-forum.com/u/bluegreen)\
**Post date:** [September 11, 2010, 12:40am UTC](https://www.ruby-forum.com/t/schedule-to-run-a-method/194793/2 "2010-09-11T00:40:46Z")

</div>

Quoting Ichiro S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Hi, everyone. I wrote a ror app. One of the methods in controller  
> extracts data from files and saves it to database. Because there are  
> many new files every night, is it possible to run this method only every  
> night or every other night? Thanks in advance.

Simplest way in Linux/Unix/MacOSX is with cron and ‘script/runner  
Class.class\_method’ or something similar. Probably best to run it as  
same  
user as the Rails server to avoid permission problems. There are other  
ways  
that may be more appropriate in some cases. If you care to share more  
details  
I could recommend an ever better method.

Jeffrey
