Jonathan Rochkind wrote:> Is there a good way to run a rake task from a crontab?
>
>
> Which is kind of ugly. Is there some way to set a value in the rake
> command line to eliminate the need for the explicit ''cd''?
I don''t know if something like "Make -C" exists with Rake
> It seems like I''d need to put in my crontab:
> "cd rails_dir; rake whatever".
Seems to be the best way, that''s not soo ugly.
http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial
0 0 * * * cd /var/www/apps/rails_app/ && /usr/local/bin/rake
RAILS_ENV=production namespace:task
You can put this command in a little script shell named rake.sh
something like
#!/bin/sh
cd /var/www/apps/rails_app/ && /usr/local/bin/rake RAILS_ENV=production
$1
and in your crontab :
0 0 * * * ~/take.sh namespace:task
Litle bit more sexy :)
I hop I helped you.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---