How in Rails do you set up a scheduled process, i.e. something that for example periodically sends out an email to the site''s users. Is this possible? -- Frank Kim http://betweengo.com/ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 30 Nov 2005, at 21:47, Frank Kim wrote:> How in Rails do you set up a scheduled process, i.e. something that > for example periodically sends out an email to the site''s users. > Is this possible?I''d do this by having a scheduled job visit your mail controller and call a send_email action at a regular interval. Make sure you authenticate the job -- check IP addresses etc -- so that people can''t cause your app to send email by visiting the wrong URI. Yours, Craig -- Craig Webster | t: +44 (0)131 516 8595 | e: craig-07VhxHapISisTnJN9+BGXg@public.gmane.org Xeriom.NET | f: +44 (0)709 287 1902 | w: http://xeriom.net
Hi Craig, I am guessing you mean that the scheduled job is created outside of rails, whether it be a wget in a cron job or something like that, instead of within rails, right? -Frank On 11/30/05, Craig Webster <craig-07VhxHapISisTnJN9+BGXg@public.gmane.org> wrote:> > On 30 Nov 2005, at 21:47, Frank Kim wrote: > > How in Rails do you set up a scheduled process, i.e. something that > > for example periodically sends out an email to the site''s users. > > Is this possible? > > I''d do this by having a scheduled job visit your mail controller and > call a send_email action at a regular interval. Make sure you > authenticate the job -- check IP addresses etc -- so that people > can''t cause your app to send email by visiting the wrong URI. > > Yours, > Craig > -- > Craig Webster | t: +44 (0)131 516 8595 | e: craig-07VhxHapISisTnJN9+BGXg@public.gmane.org > Xeriom.NET | f: +44 (0)709 287 1902 | w: http://xeriom.net > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Frank, Take a look at this page on the wiki: http://wiki.rubyonrails.com/rails/pages/HowToRunBackgroundJobsInRails Cody On 11/30/05, Frank Kim <railsonly-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Craig, > I am guessing you mean that the scheduled job is created outside of rails, > whether it be a wget in a cron job or something like that, instead of within > rails, right? > -Frank > > > > On 11/30/05, Craig Webster <craig-07VhxHapISisTnJN9+BGXg@public.gmane.org> wrote: > > On 30 Nov 2005, at 21:47, Frank Kim wrote: > > > How in Rails do you set up a scheduled process, i.e. something that > > > for example periodically sends out an email to the site''s users. > > > Is this possible? > > > > I''d do this by having a scheduled job visit your mail controller and > > call a send_email action at a regular interval. Make sure you > > authenticate the job -- check IP addresses etc -- so that people > > can''t cause your app to send email by visiting the wrong URI. > > > > Yours, > > Craig > > -- > > Craig Webster | t: +44 (0)131 516 8595 | e: craig-07VhxHapISisTnJN9+BGXg@public.gmane.org > > Xeriom.NET | f: +44 (0)709 287 1902 | w: http://xeriom.net > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- http://www.codyfauser.com
Thanks. Based on that page it looks like the best answer for now is to use cron with wget, not the most satisfying answer. On 11/30/05, Cody Fauser <codyfauser-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Frank, > > Take a look at this page on the wiki: > http://wiki.rubyonrails.com/rails/pages/HowToRunBackgroundJobsInRails > > > Cody > > On 11/30/05, Frank Kim <railsonly-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi Craig, > > I am guessing you mean that the scheduled job is created outside of > rails, > > whether it be a wget in a cron job or something like that, instead of > within > > rails, right? > > -Frank > > > > > > > > On 11/30/05, Craig Webster <craig-07VhxHapISisTnJN9+BGXg@public.gmane.org> wrote: > > > On 30 Nov 2005, at 21:47, Frank Kim wrote: > > > > How in Rails do you set up a scheduled process, i.e. something that > > > > for example periodically sends out an email to the site''s users. > > > > Is this possible? > > > > > > I''d do this by having a scheduled job visit your mail controller and > > > call a send_email action at a regular interval. Make sure you > > > authenticate the job -- check IP addresses etc -- so that people > > > can''t cause your app to send email by visiting the wrong URI. > > > > > > Yours, > > > Craig > > > -- > > > Craig Webster | t: +44 (0)131 516 8595 | e: craig-07VhxHapISisTnJN9+BGXg@public.gmane.org > > > Xeriom.NET | f: +44 (0)709 287 1902 | w: http://xeriom.net > > > > > > > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > -- > http://www.codyfauser.com > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Frank Kim http://betweengo.com/ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
on an app I had to do something along these lines i created a cron dir off the project root, and just created a .rb script and added it to my cron.. add the following to the top to work within your environment/app: #!/usr/bin/ruby ENV[''RAILS_ENV''] = ''production'' require File.dirname(__FILE__) + ''/../config/environment'' On Wed, 2005-11-30 at 20:49 -0500, Cody Fauser wrote:> Frank, > > Take a look at this page on the wiki: > http://wiki.rubyonrails.com/rails/pages/HowToRunBackgroundJobsInRails > > > Cody > > On 11/30/05, Frank Kim <railsonly-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi Craig, > > I am guessing you mean that the scheduled job is created outside of rails, > > whether it be a wget in a cron job or something like that, instead of within > > rails, right? > > -Frank > > > > > > > > On 11/30/05, Craig Webster <craig-07VhxHapISisTnJN9+BGXg@public.gmane.org> wrote: > > > On 30 Nov 2005, at 21:47, Frank Kim wrote: > > > > How in Rails do you set up a scheduled process, i.e. something that > > > > for example periodically sends out an email to the site''s users. > > > > Is this possible? > > > > > > I''d do this by having a scheduled job visit your mail controller and > > > call a send_email action at a regular interval. Make sure you > > > authenticate the job -- check IP addresses etc -- so that people > > > can''t cause your app to send email by visiting the wrong URI. > > > > > > Yours, > > > Craig > > > -- > > > Craig Webster | t: +44 (0)131 516 8595 | e: craig-07VhxHapISisTnJN9+BGXg@public.gmane.org > > > Xeriom.NET | f: +44 (0)709 287 1902 | w: http://xeriom.net > > > > > > > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > -- > http://www.codyfauser.com > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Frank, You can''t use script/runner with cron? Its usage should be described on that same page. Cody On 11/30/05, Jerrett Taylor <jerrett-7g3wz9A/6AxWk0Htik3J/w@public.gmane.org> wrote:> on an app I had to do something along these lines i created a cron dir > off the project root, and just created a .rb script and added it to my > cron.. add the following to the top to work within your environment/app: > > #!/usr/bin/ruby > ENV[''RAILS_ENV''] = ''production'' > require File.dirname(__FILE__) + ''/../config/environment'' > > > > > On Wed, 2005-11-30 at 20:49 -0500, Cody Fauser wrote: > > Frank, > > > > Take a look at this page on the wiki: > > http://wiki.rubyonrails.com/rails/pages/HowToRunBackgroundJobsInRails > > > > > > Cody > > > > On 11/30/05, Frank Kim <railsonly-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi Craig, > > > I am guessing you mean that the scheduled job is created outside of rails, > > > whether it be a wget in a cron job or something like that, instead of within > > > rails, right? > > > -Frank > > > > > > > > > > > > On 11/30/05, Craig Webster <craig-07VhxHapISisTnJN9+BGXg@public.gmane.org> wrote: > > > > On 30 Nov 2005, at 21:47, Frank Kim wrote: > > > > > How in Rails do you set up a scheduled process, i.e. something that > > > > > for example periodically sends out an email to the site''s users. > > > > > Is this possible? > > > > > > > > I''d do this by having a scheduled job visit your mail controller and > > > > call a send_email action at a regular interval. Make sure you > > > > authenticate the job -- check IP addresses etc -- so that people > > > > can''t cause your app to send email by visiting the wrong URI. > > > > > > > > Yours, > > > > Craig > > > > -- > > > > Craig Webster | t: +44 (0)131 516 8595 | e: craig-07VhxHapISisTnJN9+BGXg@public.gmane.org > > > > Xeriom.NET | f: +44 (0)709 287 1902 | w: http://xeriom.net > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > -- > > http://www.codyfauser.com > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- http://www.codyfauser.com