When I start my Ubuntu 12.04 vmware VM, I open up terminal and run the following commands.

    sudo /etc/init.d/postgresql start 
    /etc/init.d/apache2 start
    cd sites/name_of_rails_app
    bundle exec rake sunspot:solr:start
    bundle exec rake sunspot:solr:start RAILS_ENV=test
    rails s

And the rails server then starts in that terminal window.

Is there a way to automate all or most of this process? Everything but the `rails s` in a terminal, perhaps?

I've looked at Startup Applications, and my postgresql command (including 'sudo') is in there, but I still have to manually start the postgresql server, so I'm not sure how/if that tool works.

Thanks!