Hello All, I want to schedule a mail every day. I used whenever gem. I added gem ''whenever'' in my gemfile. Then in the terminal I did - "whenever ." which created a schedule.rb. In schedule.rd I added this piece of code:- set :environment, "development" every 2.minutes do runner "UserMailer.some_method" end Does it get invoked automatically ? or do I need to do something to invoke it? Thanks, Avi -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1ef570b4-7422-4b40-b965-9a46be791a7e%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
use whenever -w to write into system crontab ; to check if write successfully try crontab -l whenever -c to clear -- rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Tuesday, July 9, 2013 at 9:28 PM, Avi wrote:>-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/D580ED39D0B3430685EC8E64AFAD3FEC%40gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
I tried with these commands. It is fine. But the schedule.rb is not being invoked. I tried with some puts inside the method, but it is not getting invoked. result of whenever -w -> [write] crontab file written result of crontab -l :- # Begin Whenever generated tasks for: the complete path/schedule.rb 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /bin/bash -l -c ''cd "the complete path" && script/rails runner -e development ''\''''UserMailer.some_method''\'''''' # End Whenever generated tasks for: the complete path/schedule.rb On Tue, Jul 9, 2013 at 7:11 PM, rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org < rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> use > *whenever -w * > to write into system crontab ; to check if write successfully try * crontab > -l * > *whenever -c to clear* > -- > rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > Sent with Sparrow <http://www.sparrowmailapp.com/?sig> > > On Tuesday, July 9, 2013 at 9:28 PM, Avi wrote: > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/D580ED39D0B3430685EC8E64AFAD3FEC%40gmail.com > . > > For more options, visit https://groups.google.com/groups/opt_out. > > >-- Thanks, *Avi* -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAJ9B1dPZnCan0q%3DmrFRRucNA9swzARstxEUXSs31dFj8wnCsBQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
How about write out to some file as you might can not see these PUTS -- rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Tuesday, July 9, 2013 at 10:08 PM, avinash behera wrote:> I tried with these commands. It is fine. But the schedule.rb is not being invoked. > > I tried with some puts inside the method, but it is not getting invoked. > > result of whenever -w -> [write] crontab file written > > result of crontab -l :- > # Begin Whenever generated tasks for: the complete path/schedule.rb > 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /bin/bash -l -c ''cd "the complete path" && script/rails runner -e development ''\''''UserMailer.some_method''\'''''' > > > # End Whenever generated tasks for: the complete path/schedule.rb > On Tue, Jul 9, 2013 at 7:11 PM, rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org (mailto:rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org) <rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org (mailto:rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org)> wrote: > > use > > whenever -w > > to write into system crontab ; to check if write successfully try crontab -l > > whenever -c to clear > > -- > > rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org (mailto:rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org) > > Sent with Sparrow (http://www.sparrowmailapp.com/?sig) > > > > > > On Tuesday, July 9, 2013 at 9:28 PM, Avi wrote: > > > > > > > > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/D580ED39D0B3430685EC8E64AFAD3FEC%40gmail.com. > > > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > > -- > Thanks, > Avi > > > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAJ9B1dPZnCan0q%3DmrFRRucNA9swzARstxEUXSs31dFj8wnCsBQ%40mail.gmail.com. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4AB19A10C081484E8072B4BD731DF8AB%40gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
I tried with that... But i am getting error - (CRON) info (No MTA installed, discarding output) any pointers ? On Tue, Jul 9, 2013 at 7:44 PM, rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org < rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How about write out to some file as you might can not see these PUTS > > -- > rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > Sent with Sparrow <http://www.sparrowmailapp.com/?sig> > > On Tuesday, July 9, 2013 at 10:08 PM, avinash behera wrote: > > I tried with these commands. It is fine. But the schedule.rb is not being > invoked. > > I tried with some puts inside the method, but it is not getting invoked. > > result of whenever -w -> [write] crontab file written > > result of crontab -l :- > # Begin Whenever generated tasks for: the complete path/schedule.rb > 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 > * * * * /bin/bash -l -c ''cd "the complete path" && script/rails runner -e > development ''\''''UserMailer.some_method''\'''''' > > > # End Whenever generated tasks for: the complete path/schedule.rb > > On Tue, Jul 9, 2013 at 7:11 PM, rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org < > rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > use > *whenever -w * > to write into system crontab ; to check if write successfully try * crontab > -l * > *whenever -c to clear* > -- > rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > Sent with Sparrow <http://www.sparrowmailapp.com/?sig> > > On Tuesday, July 9, 2013 at 9:28 PM, Avi wrote: > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/D580ED39D0B3430685EC8E64AFAD3FEC%40gmail.com > . > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > -- > Thanks, > *Avi* > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/CAJ9B1dPZnCan0q%3DmrFRRucNA9swzARstxEUXSs31dFj8wnCsBQ%40mail.gmail.com > . > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/4AB19A10C081484E8072B4BD731DF8AB%40gmail.com > . > > For more options, visit https://groups.google.com/groups/opt_out. > > >-- Thanks, *Avi* -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAJ9B1dOodhL7enpxmrr37Kb3rYVre7-WSVfGFoWfNOL3bjz1yw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
On Jul 10, 2013, at 5:04 AM, avinash behera <aavinash.behera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I tried with that... > But i am getting error - (CRON) info (No MTA installed, discarding output) > any pointers ?This is because the normal behavior for cron is to send the combined STDOUT and STDERR to the owner of the crontab as an e-mail message. You don''t have anything that can accept and deliver e-mail on your server (or whatever is running cron) as it cannot find the MTA (Mail Transfer Agent) and so is telling you it''s just dropping the output of the command in the bit bucket. This has absolutely nothing to do with the whenever gem, ruby, rails or anything else. This is a base OS-level issue. If you want the output of the cron command, you have a couple of choices: 1) Append it to a log file the cron job has write access to. 2) Install a mail transfer agent. #1 is by far the easier of the two. If cron is running as root, Just append ''>> /var/log/cron.log 2>&1'' (without quotes) to each crontab command. If cron is running as a regular user, append ''>> $HOME/.cron.log 2>&1''.> > On Tue, Jul 9, 2013 at 7:44 PM, rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <rubyonrailsx@gmail.com> wrote: > How about write out to some file as you might can not see these PUTS > > -- > rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > Sent with Sparrow > > On Tuesday, July 9, 2013 at 10:08 PM, avinash behera wrote: > >> I tried with these commands. It is fine. But the schedule.rb is not being invoked. >> >> I tried with some puts inside the method, but it is not getting invoked. >> >> result of whenever -w -> [write] crontab file written >> >> result of crontab -l :- >> # Begin Whenever generated tasks for: the complete path/schedule.rb >> 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /bin/bash -l -c ''cd "the complete path" && script/rails runner -e development ''\''''UserMailer.some_method''\'''''' >> >> >> # End Whenever generated tasks for: the complete path/schedule.rb >> >> On Tue, Jul 9, 2013 at 7:11 PM, rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <rubyonrailsx@gmail.com> wrote: >>> use >>> whenever -w >>> to write into system crontab ; to check if write successfully try crontab -l >>> whenever -c to clear >>> -- >>> rubyonrailsx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >>> Sent with Sparrow >>> >>> On Tuesday, July 9, 2013 at 9:28 PM, Avi wrote: >> >> >> -- >> Thanks, >> Avi-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0CD89D68-2F64-46D0-BDB0-C18C9CF74316%40gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Reasonably Related Threads
- rails-brakeman.com, an online service to find security issues in your rails projects
- Couldn't reload a module when it's changed. Tried :require_dependency, :watchable_dirs, :unloadable
- Unexpected behavior looping through sequence of dates
- Preserve CDR unique across multiple servers
- Packet loss between Xen machines