Skip to content

Commit

Permalink
Added Actor#tail method that makes it easy to create cross-server tai…
Browse files Browse the repository at this point in the history
…ls [DHH]

git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@4162 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Apr 4, 2006
1 parent a8ec141 commit 55e7c7f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG
@@ -1,5 +1,12 @@
*SVN*

* Added Actor#tail method that makes it easy to create cross-server tails [DHH]. Example:

desc "Run a tail on multiple log files at the same time"
task :tail_fcgi, :roles => :app do
tail "#{shared_path}/log/fastcgi.crash.log"
end

* Make update_code and symlink a macro task under the name "update" for easy of deploy to servers that does not run fcgis [DHH]

* Changed setup, update_code, rollback_code, and symlink to work on all servers instead of only those in the :app, :web, and :db roles. A server can opt out of being part of the release deployment by setting :no_release => true [DHH]
Expand Down
21 changes: 21 additions & 0 deletions lib/capistrano/actor.rb
Expand Up @@ -212,6 +212,27 @@ def run(cmd, options={}, &block)
end
end

# Puts a tail on the file from all servers that are the target of the
# current task. All the tails will be joined into a single coherent stream,
# so you can watch 10 log files as though they were one. Do note that this
# is quite expensive from a bandwidth perspective, so use it with care.
#
# Example:
#
# desc "Run a tail on multiple log files at the same time"
# task :tail_fcgi, :roles => :app do
# tail "#{shared_path}/log/fastcgi.crash.log"
# end
def tail(file)
run "tail -f #{file}" do |ch, stream, out|
puts out if stream == :out
if stream == :err
puts "[err : #{ch[:host]}] #{out}"
break
end
end
end

# Deletes the given file from all servers targetted by the current task.
# If <tt>:recursive => true</tt> is specified, it may be used to remove
# directories.
Expand Down

0 comments on commit 55e7c7f

Please sign in to comment.