def acquire_lock
      return true if @handle
      begin
        @handle = File.open(status_file_path, File::RDWR | File::CREAT)
        raise StandardError.new('Already locked') unless @handle.flock(File::LOCK_EX | File::LOCK_NB)
        @handle.rewind
        @handle.truncate 0
      rescue
        if @handle
          @handle.flock(File::LOCK_UN)
          @handle.close
        end
        @handle = nil
      end
      !!@handle
    end
def acquire_lock
      return true if @handle
      begin
        @handle = File.open(status_file_path, File::RDWR | File::CREAT)
        raise StandardError.new('Already locked') unless @handle.flock(File::LOCK_EX | File::LOCK_NB)
        @handle.rewind
        @handle.truncate 0
      rescue
        if @handle
          @handle.flock(File::LOCK_UN)
          @handle.close
        end
        @handle = nil
      end
      !!@handle
    end
Acquires the lock on the status/lock file.

 Returns true on success or if this instance already holds the lock.
 Returns false if another process holds the lock.