Help me plan my Ruby app :)

A

Alex Baranosky

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
 
B

Ben Bleything

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 =A0have it start running on startup. =A0The webapp versio= n,
seems like the better approach, though I'd like to avoid paying much of
anything for the hosting. =A0My 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... =A0Maybe 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:
http://github.com/mojombo/chronic

Ben
 
A

Alex Baranosky

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.
 
B

Ben Bleything

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
 
J

Jörg W Mittag

Ben said:
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:

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

jwm
 
W

Walton Hoops

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
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.
 
A

Alex Baranosky

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?
 
A

Alex Baranosky

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?
 
A

Alex Baranosky

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
 
A

Alex Baranosky

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top