# Problem adding the OpenWFEru scheduler code in Initialzers

**URL:** <https://www.ruby-forum.com/t/problem-adding-the-openwferu-scheduler-code-in-initialzers/151507>\
**Category:** Rails\
**Created:** [October 22, 2008, 9:06am UTC](https://www.ruby-forum.com/t/problem-adding-the-openwferu-scheduler-code-in-initialzers/151507 "2008-10-22T09:06:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![karthikeyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/898d66/32.png) [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Post date:** [October 22, 2008, 9:06am UTC](https://www.ruby-forum.com/t/problem-adding-the-openwferu-scheduler-code-in-initialzers/151507/1 "2008-10-22T09:06:38Z")

</div>

Hi,

I am using OpenWFEru gem for scheduling the weekly mailing in my rails  
application. I have written the scheduler code as a stand-alone ruby  
code. So I have to run it separately.

But I want this scheduler to start when I start my rails server. I tried  
putting this ruby code in config/initializers. But the server is not  
getting started as this scheduler code keeps on running.

Following is my ruby code in config/initializers.

require ‘openwfe/util/scheduler’  
include OpenWFE

scheduler = Scheduler.new  
scheduler.start

scheduler.schedule(‘0 9 \* \* 1’) do  
system “ruby D:\Projects\Producteering\script\runner  
Person.send\_weekly\_digest”  
end

scheduler.join

Am I doing anything wrong? Or is there any way to achieve this?

Thanks in advance…
