views:

26

answers:

1

So every morning to boot up my server , I need to do the following tasks..

>> sunspot-solr stop
>> sunspot-solr start
>> script/console
>> Organization.reindex
>> Event.reindex
>> Deal.reindex
>> exit
>> script/server

Is there any way I can make a shortcut in my ~/.profile as an alias to perform all this for me without me typing it everyday?

Like this though it doesn't work ?

alias blam='cur && sunspot-solr stop && sunspot-solr start && script/console && Organization.reindex && Event.reindex && Deal.reindex && exit && script/server'
+1  A: 

Maybe this will ease some of the pain?

#Rakefile
desc "Reindex the organizations, events, and deals Solr indexes."
task :reindex => :environment do
  Organization.reindex
  Event.reindex
  Deal.reindex
end

Then every morning run

> sunspot-solr stop
> sunspot-solr start
> rake reindex
> script/server
Justice
Would those commands work even though I'm not invoking script/console?
Trip
** Invoke reindex (first_time)** Execute reindexrake aborted!uninitialized constant Organization
Trip
Awesome! Thanks for the update! Works now
Trip
Edited. Need to declare that this task depends on the Rails-defined task `environment`. Use `task :reindex => :environment do ... end`.
Justice