# Help me plan my Ruby app :)

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

On Mon, Mar 22, 2010 at 5:50 PM, Alex B. [email protected]
wrote:

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
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:
http://github.com/mojombo/chronic

Ben

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.

On Mon, Mar 22, 2010 at 7:57 PM, Alex B. [email protected]
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. I suppose in the worst case you could install it as a service
and just sleep in between runs.

Ben

Ben B. wrote:

On Mon, Mar 22, 2010 at 7:57 PM, Alex B. [email protected] 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.

like:

schtasks /Create /SC HOURLY /TN Reminder /TR C:\Path\to\reminder.rb


jwm

On 3/22/2010 9:00 PM, Ben B. wrote:

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.

Very useful jwm, thanks.

schtasks /Create /SC HOURLY /TN Reminder /TR C:\Path\to\reminder.rb


jwm

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?

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?

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.

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.