Skip to content

Commit

Permalink
Using a global lock: only one instance at a time
Browse files Browse the repository at this point in the history
  • Loading branch information
phinze committed May 13, 2009
1 parent fdb0b3b commit 2b51f04
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bin/cerberus
@@ -1,7 +1,13 @@
#!/usr/bin/env ruby

$: << File.expand_path(File.dirname(__FILE__)) + '/../lib'
# Add lib dir to load path so that we don't have to be installed in rubygems
require 'pathname' # Use Pathname to follow symlinks
CERBERUS_LIB_DIR = File.join(File.dirname(Pathname.new(__FILE__).realpath),'..','lib')
$: << CERBERUS_LIB_DIR

require 'cerberus/cli'
require 'cerberus/latch'

Cerberus::CLI.new(*ARGV)
Cerberus::Latch.lock('/tmp/cerberus.lock', :lock_ttl => 2 * Cerberus::LOCK_WAIT ) do
Cerberus::CLI.new(*ARGV)
end

0 comments on commit 2b51f04

Please sign in to comment.