# File lib/rbg.rb, line 260
    def start(config_file, options = {})
      options[:background]  ||= false
      options[:environment] ||= "development"
      $rbg_env = options[:environment].dup
      
      # Define the config file then load it
      self.config_file = config_file
      self.load_config
      
      # If the PID file is set and exists, check that the process is not running
      if self.config.pid_path and File.exists?(self.config.pid_path)
        oldpid = File.read(self.config.pid_path)
        begin
          Process.getpgid( oldpid.to_i )
          raise Error, "Process already running! PID #{oldpid}"
        rescue Errno::ESRCH
          # No running process
          false
        end
      end
      
      # Initialize child process array
      self.child_processes = Hash.new
      
      if options[:background]
        # Fork the master control process and return to a shell
        master_pid = fork do
          # Ignore input and log to a file
          STDIN.reopen('/dev/null')
          if self.config.log_path
            STDOUT.reopen(self.config.log_path, 'a')
            STDOUT.sync = true
            STDERR.reopen(self.config.log_path, 'a')
            STDERR.sync = true
          else
            raise Error, "Log location not specified in '#{config_file}'"
          end
          
          self.master_process
        end
        
        # Ensure the process is properly backgrounded
        Process.detach(master_pid)
        if self.config.pid_path
          File.open(self.config.pid_path, 'w') {|f| f.write(master_pid) }
        end
        
        logger.info "Master started as PID #{master_pid}"
      else
        # Run using existing STDIN / STDOUT and set logger to use use STDOUT regardless
        self.config.logger = MonoLogger.new(STDOUT)
        self.master_process
      end
    end