# File lib/rbot/ircbot.rb, line 1111
  def shutdown(message=nil)
    @quit_mutex.synchronize do
      debug "Shutting down: #{message}"
      ## No we don't restore them ... let everything run through
      # begin
      #   trap("SIGINT", "DEFAULT")
      #   trap("SIGTERM", "DEFAULT")
      #   trap("SIGHUP", "DEFAULT")
      # rescue => e
      #   debug "failed to restore signals: #{e.inspect}\nProbably running on windows?"
      # end
      debug "\tdisconnecting..."
      disconnect(message)
      debug "\tstopping timer..."
      @timer.stop
      debug "\tsaving ..."
      save
      debug "\tcleaning up ..."
      @save_mutex.synchronize do
        @plugins.cleanup
      end
      # debug "\tstopping timers ..."
      # @timer.stop
      # debug "Closing registries"
      # @registry.close
      debug "\t\tcleaning up the db environment ..."
      DBTree.cleanup_env
      log "rbot quit (#{message})"
    end
  end