Sha256: 0a14749dd7f4a86b0d9692eb9b892d6a17d0183e70359eb5577f97f5fc1abbac

Contents?: true

Size: 621 Bytes

Versions: 3

Compression:

Stored size: 621 Bytes

Contents

module Hookit
  module Resource
    class Logrotate < Base

      field :path
      field :filesize
      field :max_size
      field :count

      actions :create
      default_action :create

      def initialize(name)
        path name unless path
        super
      end

      def run(action)
        case action
        when :create
          create!
        end
      end

      protected

      def create!
        case platform.os
        when 'sun'
          run_command! `logadm -c -w #{path} -s #{filesize ||= '10m'} -S #{max_size ||= '500m'} -C #{count ||= '10'} -N`
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
micro-hookit-0.12.13 lib/hookit/resource/logrotate.rb
micro-hookit-0.12.12 lib/hookit/resource/logrotate.rb
micro-hookit-0.12.11 lib/hookit/resource/logrotate.rb