#!/usr/bin/env ruby require "bundler/setup" require "redis_getlock" require 'logger' if ARGV[0] == 'exit!' trap('INT') do exit! end end mutex = RedisGetlock.new(redis: Redis.new, key: 'redis_getlock', logger: Logger.new(STDOUT)) puts 'redis-cli> del redis_getlock' mutex.synchronize do loop do puts mutex.locked? sleep 1 end end