All:

Thanks for the replies.  I tried Jeff's syntax:

if Time.now.wday == 1

and it worked perfectly.  Thanks!

I'll check into the other ideas, including Simpleworker.  Thanks!!!

ps...I'm on Rails 3.0.3....dont know what Ruby I'm on.  Thx.

On Mar 31, 1:45 pm, Chris Hanks <christopher.m.ha...@gmail.com> wrote:
> Oh, you must be on Ruby 1.8.7, then? You'll have Time#thursday? (and
> the other days of the week) on 1.9, or if you're using Rails.
>
> Sorry for the confusion. Jeff's suggestion is best, but when you
> upgrade to 1.9 I'd suggest using Time#thursday?, since it's so much
> more readable.
>
> On Mar 31, 10:14 am, Doug Naegele <dougnaeg...@gmail.com> wrote:
>
>
>
> > Thanks Chris.
>
> > Sorry, it didn't work.
>
> > Here's my code:
>
> >   if Time.now.thursday?
> >     puts "Send report"
> >     uri = URI.parse('http://myapp.heroku.com/messages/send_report')
> >     Net::HTTP.get(uri)
> >     puts " Report put is done."
> >   end
>
> > Here's the error output (after I ran heroku rake cron --trace)
>
> > ** Invoke cron (first_time)
> > ** Invoke environment (first_time)
> > ** Execute environment
> > ** Execute cron
> > rake aborted!
> > undefined method `thursday?' for Thu Mar 31 10:06:51 -0700 2011:Time
> > /app/lib/tasks/cron.rake:28
>
> > (if Time.now.thursday? is line 28)
>
> > -----
>
> > the following also throws an error:
>
> > if Time.now == thursday
> > .
> > .
> > .
> > .
>
> > (output below)
> > rake aborted!
> > undefined local variable or method `thursday' for main:Object
>
> > ----
>
> > this also throws an error:
>
> > if Time.now.day == thursday
> > .
> > .
> > .
> > .
> > (output below)
> > rake aborted!
> > undefined local variable or method `thursday' for main:Object
>
> > On Mar 31, 12:32 pm, Chris Hanks <christopher.m.ha...@gmail.com>
> > wrote:
>
> > > Try: Time.now.monday?
>
> > > On Mar 31, 8:16 am, Doug Naegele <dougnaeg...@gmail.com> wrote:
>
> > > > Can someone help me configure Heroku Cron to only run on a certain
> > > > day?
>
> > > > So, imagine I send an email report every Monday morning.  How do I
> > > > write the syntax for that?
>
> > > > Something like this:
>
> > > > This one works:
>
> > > >   if Time.now.hour == 7  ##Sends report @7am, PST.
> > > >     puts "Send report"
> > > >     uri = URI.parse('http://myapp.heroku.com/messages/send_report')
> > > >     Net::HTTP.get(uri)
> > > >     puts " Report is done."
> > > >   end
>
> > > > This one does not work:
>
> > > >   if Time.now == Monday  ##Sends report at the daily Heroku cron run,
> > > > but only on Monday.
> > > >     puts "Send report"
> > > >     uri = URI.parse('http://myapp.heroku.com/messages/send_report')
> > > >     Net::HTTP.get(uri)
> > > >     puts " Report is done."
> > > >   end
>
> > > > thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to