Sha256: bdaa339006ecbd33dd05ec291c8fa770b3f9313c7de1bfe08c48ad3a9f501abb

Contents?: true

Size: 1011 Bytes

Versions: 13

Compression:

Stored size: 1011 Bytes

Contents

#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
$:.push File.expand_path(File.join('..','..','lib'), __FILE__)

require "rubygems"
require "bundler"
Bundler.setup

FileUtils.mkdir_p('tmp/pids') unless File.exists?('tmp/pids')

require 'with_lock'
if ARGV.include?('start')
  begin
    locker = WithLock::Client.locker
  rescue WithLock::LockException => e
    puts "Starting WithLock on #{WithLock::Server::url}!"
    WithLock::Server::start_service
    locker = WithLock::Client.locker
  end
  puts "Clearing WithLock locks!"
  locker = WithLock::Client.locker
  locker.locks.each_pair do |lock,data|
    pid = data[:owner].split('|').last
    if locker.running?(pid) || !data[:owner].include?(`hostname`.strip)
      puts "Running - pid"
    else
      puts "Not Running - pid"
      locker.release(data[:owner],lock)
    end
  end
elsif ARGV.include?('stop')
  puts "Stopping WithLock!"
  WithLock::Server::stop_service
elsif ARGV.include?('run')
  puts "Running WithLock!"
  WithLock::Server::run_service
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
mail_manager-3.2.25.1 script/with_lock
mail_manager-3.2.22.0 script/with_lock
mail_manager-3.2.7 script/with_lock
mail_manager-3.2.6 script/with_lock
mail_manager-3.2.5 script/with_lock
mail_manager-3.2.4 script/with_lock
mail_manager-3.2.2 script/with_lock
mail_manager-3.2.1 script/with_lock
mail_manager-3.2.0 script/with_lock
mail_manager-3.0.0 script/with_lock
with_lock-0.1.1 script/with_lock
with_lock-0.1 script/with_lock
with_lock-0.0.4.alpha script/with_lock