# Help me plan my Ruby app :)

**URL:** <https://rubytalk.org/t/help-me-plan-my-ruby-app/57839>\
**Category:** ruby-talk\
**Created:** [23 March 2010 00:50 UTC](https://rubytalk.org/t/help-me-plan-my-ruby-app/57839 "2010-03-23T00:50:33Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Baranosky](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@Alex\_Baranosky](https://rubytalk.org/u/Alex_Baranosky)\
**Post date:** [23 March 2010 00:50 UTC](https://rubytalk.org/t/help-me-plan-my-ruby-app/57839/1 "2010-03-23T00:50:33Z")

</div>

So I am interested in writing a program to read a file I write, with  
different reminder info in it, and then have it send emails to my  
account with the proper message on the proper days as reminders for me.

Ruby's one of my favorite languages so I thought I'd code it in Ruby.

At first thought it seems I would like this software to run all the  
time, so a web app would make most sense.

Then I thought I could probably get away with having it run in the  
background, and have it start running on startup. The webapp version,  
seems like the better approach, though I'd like to avoid paying much of  
anything for the hosting. My bandwidth usage would be TINY, so perhaps  
something that charges by the bandwidth would be best option for this?  
(Heroku??)

An ideas on what would be some good ideas for a little app like this?  
Ruby-world specific libraries, or Rails libraries etc... Maybe Rails  
isn't even the right approach, considering how simple the webapp is;  
it's really just a extremely simple service; its just a glorified spam  
bot 😉 (for myself)

All ideas are welcome.

Thanks for the help,  
Alex

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Ben\_Bleything1](https://avatars.discourse-cdn.com/v4/letter/b/3e96dc/32.png) [@Ben\_Bleything1](https://rubytalk.org/u/Ben_Bleything1)\
**Post date:** [23 March 2010 02:05 UTC](https://rubytalk.org/t/help-me-plan-my-ruby-app/57839/2 "2010-03-23T02:05:11Z")

</div>

> So I am interested in writing a program to read a file I write, with  
> different reminder info in it, and then have it send emails to my  
> account with the proper message on the proper days as reminders for me.

Neat!

> At first thought it seems I would like this software to run all the  
> time, so a web app would make most sense.

Does it? I don't think so.

> Then I thought I could probably get away with having it run in the  
> background, and have it start running on startup. The webapp version,  
> seems like the better approach, though I'd like to avoid paying much of  
> anything for the hosting. My bandwidth usage would be TINY, so perhaps  
> something that charges by the bandwidth would be best option for this?  
> (Heroku??)

Sure, a webapp is running all the time, but unless there's a request  
coming in, it's not doing anything. That means that you'd need to  
automate something to hit the app every so often to get it to do  
whatever it is you want to do.

> An ideas on what would be some good ideas for a little app like this?  
> Ruby-world specific libraries, or Rails libraries etc... Maybe Rails  
> isn't even the right approach, considering how simple the webapp is;  
> it's really just a extremely simple service; its just a glorified spam  
> bot 😉 (for myself)

Skip the webapp idea altogether. What you want is a script that can  
parse a file and for each entry in the file say "do I need to email  
about this?" and then either do so or move on to the next. Then, set  
it up to run under cron however often you like, and you're set.  
You'll likely want to leave behind an artifact of the last run time,  
so you'll know when the last run was and therefore be able to figure  
out if any events fired in the meantime.

You might be interested in chronic for date parsing:

> **[GitHub - mojombo/chronic: Chronic is a pure Ruby natural language date parser.](https://github.com/mojombo/chronic)**
>
> Chronic is a pure Ruby natural language date parser. - GitHub - mojombo/chronic: Chronic is a pure Ruby natural language date parser.

Ben

> **···**
>
> On Mon, Mar 22, 2010 at 5:50 PM, Alex Baranosky \<abaranosky@hotmail.com\> wrote:

---

<div class="post-metadata">

**Author:** ![Alex\_Baranosky](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@Alex\_Baranosky](https://rubytalk.org/u/Alex_Baranosky)\
**Post date:** [23 March 2010 02:57 UTC](https://rubytalk.org/t/help-me-plan-my-ruby-app/57839/3 "2010-03-23T02:57:38Z")

</div>

Oh thanks for the ideas Ben,

I guess you're right now that I think of it.

I'll have to look into setting cron jobs on windows.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Ben\_Bleything1](https://avatars.discourse-cdn.com/v4/letter/b/3e96dc/32.png) [@Ben\_Bleything1](https://rubytalk.org/u/Ben_Bleything1)\
**Post date:** [23 March 2010 03:00 UTC](https://rubytalk.org/t/help-me-plan-my-ruby-app/57839/4 "2010-03-23T03:00:28Z")

</div>

I'm sure there's a native alternative to cron, but I have no idea what  
it is. I suppose in the worst case you could install it as a service  
and just sleep in between runs.

Ben

> **···**
>
> On Mon, Mar 22, 2010 at 7:57 PM, Alex Baranosky \<abaranosky@hotmail.com\> wrote:
> 
> > I'll have to look into setting cron jobs on windows.

---

<div class="post-metadata">

**Author:** ![Jorg\_W\_Mittag1](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@Jorg\_W\_Mittag1](https://rubytalk.org/u/Jorg_W_Mittag1)\
**Post date:** [23 March 2010 04:45 UTC](https://rubytalk.org/t/help-me-plan-my-ruby-app/57839/5 "2010-03-23T04:45:06Z")

</div>

Ben Bleything wrote:

> **···**
>
> > On Mon, Mar 22, 2010 at 7:57 PM, Alex Baranosky \<abaranosky@hotmail.com\> wrote:
> > 
> > > I'll have to look into setting cron jobs on windows.
> > 
> > I'm sure there's a native alternative to cron, but I have no idea what  
> > it is.
> 
> Task Scheduler, managed through the schtasks.exe command. Something  
> like:
> 
> &nbsp;&nbsp;&nbsp;&nbsp;schtasks /Create /SC HOURLY /TN Reminder /TR C:\Path\to\reminder.rb
> 
> jwm

---

<div class="post-metadata">

**Author:** ![Walton\_Hoops1](https://avatars.discourse-cdn.com/v4/letter/w/77aa72/32.png) [@Walton\_Hoops1](https://rubytalk.org/u/Walton_Hoops1)\
**Post date:** [23 March 2010 04:45 UTC](https://rubytalk.org/t/help-me-plan-my-ruby-app/57839/6 "2010-03-23T04:45:32Z")

</div>

Scheduled tasks in XP/2003. Task Scheduler in Vista and newer. I agree  
that they are plenty powerful for this. Another option on a Windows box  
if your feeling fancy is the win32-service gem for writing Windows  
services and rufus-scheduler for cron-like behavior.

> **···**
>
> On 3/22/2010 9:00 PM, Ben Bleything wrote:
> 
> > On Mon, Mar 22, 2010 at 7:57 PM, Alex Baranosky \<abaranosky@hotmail.com\> wrote:  
> > &nbsp;&nbsp;
> > 
> > > I'll have to look into setting cron jobs on windows.  
> > > &nbsp;&nbsp;&nbsp;&nbsp;
> > 
> > I'm sure there's a native alternative to cron, but I have no idea what  
> > it is. I suppose in the worst case you could install it as a service  
> > and just sleep in between runs.
> > 
> > Ben

---

<div class="post-metadata">

**Author:** ![Alex\_Baranosky](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@Alex\_Baranosky](https://rubytalk.org/u/Alex_Baranosky)\
**Post date:** [26 March 2010 04:39 UTC](https://rubytalk.org/t/help-me-plan-my-ruby-app/57839/7 "2010-03-26T04:39:56Z")

</div>

Very useful jwm, thanks.

> **···**
>
> > &nbsp;&nbsp;&nbsp;&nbsp;schtasks /Create /SC HOURLY /TN Reminder /TR C:\Path\to\reminder.rb
> > 
> > jwm
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Alex\_Baranosky](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@Alex\_Baranosky](https://rubytalk.org/u/Alex_Baranosky)\
**Post date:** [26 March 2010 06:49 UTC](https://rubytalk.org/t/help-me-plan-my-ruby-app/57839/8 "2010-03-26T06:49:51Z")

</div>

So this is what I'm doing so far.

I ran this command at the command line to schedule the task:  
schtasks /Create /SC HOURLY /TN Reminder /TR reminder.bat

Then made the reminder.bat as this:  
@echo off  
rubyw "c:\......rb"

When I run this batch file manually the console doesn't pop up. But  
when it runs via the scheduled task it IS having the console window  
popup and quickly disappear... Any idea how to get the console window  
to never show?

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Alex\_Baranosky](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@Alex\_Baranosky](https://rubytalk.org/u/Alex_Baranosky)\
**Post date:** [27 March 2010 03:36 UTC](https://rubytalk.org/t/help-me-plan-my-ruby-app/57839/9 "2010-03-27T03:36:09Z")

</div>

So the next step for me is figuring out how to send emails from an  
application on my home pc.

I've got actionmailer 3.0 beta setup. How do a I setup a windows box to  
send emails?

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Alex\_Baranosky](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@Alex\_Baranosky](https://rubytalk.org/u/Alex_Baranosky)\
**Post date:** [30 March 2010 04:27 UTC](https://rubytalk.org/t/help-me-plan-my-ruby-app/57839/10 "2010-03-30T04:27:58Z")

</div>

So guys,

I got it sending emails via smtp through my gmail account!

I have it parsing my schedule file...

And I have it in a .bat file being scheduled to run every hour by  
schtask.

But there's one last hurdle:

When I double click the BAT file it runs fine, but when I run it via  
schtask it doesn't do anything. I can tell it is running because a  
command window pops up for a split second.

Any ideas why it isn't running?

Thanks,  
Alex

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Alex\_Baranosky](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@Alex\_Baranosky](https://rubytalk.org/u/Alex_Baranosky)\
**Post date:** [30 March 2010 04:35 UTC](https://rubytalk.org/t/help-me-plan-my-ruby-app/57839/11 "2010-03-30T04:35:29Z")

</div>

Does rubyw only work with 1.9? I switched to using just ruby and it  
seems to be working 🙂

Time for bed. I'll keep you all posted on how it goes.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
