Sha256: 29e6b618a95c6f626737410706ffa3f087eace225b1b0bb2f58fb34f328582fe

Contents?: true

Size: 940 Bytes

Versions: 12

Compression:

Stored size: 940 Bytes

Contents

Capistrano::Configuration.instance(:must_exist).load do
  namespace :log do
    desc "Tail all application log files"
    task :tail, :roles => :app do
      run "tail -f #{shared_path}/log/*.log" do |channel, stream, data|
        puts "#{channel[:host]}: #{data}"
        break if stream == :err
      end
    end
    
    desc <<-DESC
    Install log rotation script; optional args: days=7, size=5M, group (defaults to same value as :user)
    DESC
    task :rotate, :roles => :app do
      rotate_script = %Q{#{shared_path}/log/#{environment}.log {
        daily
        rotate #{ENV['days'] || 7}
        size #{ENV['size'] || "5M"}
        compress
        create 640 #{user} #{ENV['group'] || user}
        missingok
      }}
      put rotate_script, "#{shared_path}/logrotate_script"
      "#{sudo} cp #{shared_path}/logrotate_script /etc/logrotate.d/#{application}"
      run "rm #{shared_path}/logrotate_script"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dark-capistrano-recipes-0.6.17 lib/recipes/log.rb
dark-capistrano-recipes-0.6.16 lib/recipes/log.rb
dark-capistrano-recipes-0.6.15 lib/recipes/log.rb
dark-capistrano-recipes-0.6.14.0 lib/recipes/log.rb
dark-capistrano-recipes-0.6.12.0 lib/recipes/log.rb
dark-capistrano-recipes-0.6.11 lib/recipes/log.rb
dark-capistrano-recipes-0.6.10 lib/recipes/log.rb
dark-capistrano-recipes-0.6.9 lib/recipes/log.rb
dark-capistrano-recipes-0.6.8 lib/recipes/log.rb
dark-capistrano-recipes-0.6.6 lib/recipes/log.rb
dark-capistrano-recipes-0.6.5 lib/recipes/log.rb
dark-capistrano-recipes-0.6.4 lib/recipes/log.rb