# File lib/main/daemon.rb, line 318
    def lock!(options = {})
      complain = options['complain'] || options[:complain]
      fd = open(@lock_file, 'r+')
      status = fd.flock(File::LOCK_EX|File::LOCK_NB)

      unless status == 0
        if complain
          pid = Integer(IO.read(@pid_file)) rescue '?'
          warn("instance(#{ pid }) is already running!")
        end
        exit(42)
      end
      @lock = fd # prevent garbage collection from closing the file!
      at_exit{ unlock! }
    end