Sha256: bef0b4da9d611232821f6f44589d331ab6f8ae20918a30f3d2c34588a27d8ded

Contents?: true

Size: 955 Bytes

Versions: 4

Compression:

Stored size: 955 Bytes

Contents

Capistrano::Configuration.instance.load do
  namespace :log do
    desc "|DarkRecipes| 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
    |DarkRecipes| 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

4 entries across 4 versions & 3 rubygems

Version Path
capistrano-recipes-0.8.0 lib/recipes/log.rb
dark-capistrano-recipes-0.7.2 lib/recipes/log.rb
dark-capistrano-recipes-0.7.0 lib/recipes/log.rb
ra-capistrano-recipes-0.7.0 lib/recipes/log.rb