Toggle Service/Task using Shell Commands in Rails Method
===

I have a method in my controller that is triggered by a link in my Rails application. Everything works perfectly in Development mode, but for whatever reason, it doesn't work in Production mode. Whenever I call one of the commands, it will turn its gears like it's trying to do something, but never actually does anything. However, the strange thing is that the REINDEX of the sunspot does work. I'm looking at my production logs and monitoring the PID files created by each of the services. Also, if I run these commands normally within my SSH Terminal session, they work fine.

      def toggle_service
        command = params[:string].to_s
        if command == 'stop_mailman_server'
          system("ruby #{::Rails.root}/script/mailman_daemon.rb stop")
        elsif  command == 'start_mailman_server'
          system("ruby #{::Rails.root}/script/mailman_daemon.rb start")
        elsif  command == 'start_search_server'
          system("rake sunspot:solr:start RAILS_ENV=#{Rails.env}")
        elsif  command == 'stop_search_server'
          system("rake sunspot:solr:stop RAILS_ENV=#{Rails.env}")
        elsif  command == 'reindex_search_server'
          system("rake sunspot:reindex RAILS_ENV=#{Rails.env}")
        end    
        redirect_to :back
      end