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