Try: Time.now.monday?


On Mar 31, 8:16 am, Doug Naegele <[email protected]> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to