require "filelock" FileLock::LockFile::create_for("/root/fact.rb") do open("fact.rb") do |fp| print fp.read end end