Module: ExtendedLockfile
- Defined in:
- lib/sup/util.rb
Instance Method Summary collapse
- #dump_lock_id(lock_id = @lock_id) ⇒ Object
- #gen_lock_id ⇒ Object
- #lockinfo_on_disk ⇒ Object
- #touch_yourself ⇒ Object
Instance Method Details
#dump_lock_id(lock_id = @lock_id) ⇒ Object
27 28 29 30 |
# File 'lib/sup/util.rb', line 27 def dump_lock_id lock_id = @lock_id "host: %s\npid: %s\nppid: %s\ntime: %s\nuser: %s\npname: %s\n" % lock_id.values_at('host','pid','ppid','time','user', 'pname') end |
#gen_lock_id ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sup/util.rb', line 16 def gen_lock_id Hash[ 'host' => "#{ Socket.gethostname }", 'pid' => "#{ Process.pid }", 'ppid' => "#{ Process.ppid }", 'time' => , 'pname' => $0, 'user' => ENV["USER"] ] end |
#lockinfo_on_disk ⇒ Object
32 33 34 35 36 37 |
# File 'lib/sup/util.rb', line 32 def lockinfo_on_disk h = load_lock_id IO.read(path) h['mtime'] = File.mtime path h['path'] = path h end |
#touch_yourself ⇒ Object
39 |
# File 'lib/sup/util.rb', line 39 def touch_yourself; touch path end |