diff options
author | David A. Cuadrado <krawek@gmail.com> | 2008-02-26 10:30:50 -0500 |
---|---|---|
committer | David A. Cuadrado <krawek@gmail.com> | 2008-02-26 10:30:50 -0500 |
commit | 9cd500ab75aa740c19fc8d90d2ca2cc8fb65a331 (patch) | |
tree | 37cda375808f5cf94e7943be267c7067a09a250e /script | |
parent | 0454fe94ec2f86a2f67f9ce92a469365a6c8337c (diff) | |
download | gitorious-mainline-outdated-9cd500ab75aa740c19fc8d90d2ca2cc8fb65a331.zip gitorious-mainline-outdated-9cd500ab75aa740c19fc8d90d2ca2cc8fb65a331.tar.gz gitorious-mainline-outdated-9cd500ab75aa740c19fc8d90d2ca2cc8fb65a331.tar.bz2 |
Check if the tasklock file exists before to load rails environment
Diffstat (limited to 'script')
-rwxr-xr-x | script/task_performer | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/script/task_performer b/script/task_performer index 1d1097d..0cca10f 100755 --- a/script/task_performer +++ b/script/task_performer @@ -1,13 +1,20 @@ #!/usr/bin/env ruby -ENV["RAILS_ENV"] ||= "production" -require File.dirname(__FILE__) + "/../config/environment" +require 'tmpdir' require "fileutils" -LOCK_FILE_PATH = File.join(RAILS_ROOT, "tmp", "task_lockfile") - +LOCK_FILE_PATH = File.join(Dir.tmpdir, "gitorious_task_lockfile") ENV["PATH"] = "/usr/local/bin/:/opt/local/bin:#{ENV["PATH"]}" +if File.exist?(LOCK_FILE_PATH) + $stderr.puts "Task lockfile '#{LOCK_FILE_PATH}' exists!" + exit(1) +end + +ENV["RAILS_ENV"] ||= "production" +require File.dirname(__FILE__) + "/../config/environment" + + class TaskLockError < StandardError; end def with_lock(&block) |