Cron Job to Schedule Rails Website Going Live?
I'm currently building a website for an awesome youth church we run (shameless plug!)..
Anywho at the moment we have a static countdown page http://mybase.co , and were having a massive launch this weekend and the site needs to go live when we launch开发者_C百科,
it's a rails app..
How would you recommend scheduling it going live?
having a cron job and an apache a2en?
or is there a better way?
Thanks
Daniel
How about putting your countdown in an index.html and using a cron job (or similar) to delete it.
And have a :before_filter
in your application controller that does a
redirect_to root_path unless Time.now > launch_time
Naturally, sometime after you launch, you'll want to remove the :before_filter
...
Try https://github.com/javan/whenever for cron jobs in ruby
Have a look into at jobs. It makes more sense than cron. As cron jobs will recur.
No need for cron jobs:
before_filter :countdown
protected
def countdown
render(:template => '/timeout') if Time.now < "01/13/2011".to_time
end
精彩评论