Class: Bard::Provision::LogRotation

Inherits:
Bard::Provision show all
Defined in:
lib/bard/provision/logrotation.rb

Overview

install log rotation if missing

Instance Attribute Summary

Attributes inherited from Bard::Provision

#config, #ssh_url

Instance Method Summary collapse

Methods inherited from Bard::Provision

call

Instance Method Details

#callObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bard/provision/logrotation.rb', line 4

def call
  print "Log Rotation:"

  provision_server.run! <<~BASH, quiet: true
    file=/etc/logrotate.d/#{server.project_name}
    if [ ! -f $file ]; then
      sudo tee $file > /dev/null <<EOF
    $(pwd)/log/*.log {
      weekly
      size 100M
      missingok
      rotate 52
      delaycompress
      notifempty
      copytruncate
      create 664 www www
    }
    EOF
    fi
  BASH

  puts ""
end