Puppet Class: postgresql::maintenance::analyze

Inherits:
postgresql::params
Defined in:
manifests/maintenance/analyze.pp

Overview

Parameters:

  • ensure (Any) (defaults to: 'present')
  • basedir (Any) (defaults to: '/usr/local/bin')
  • setcronjob (Any) (defaults to: true)
  • hour_cronjob (Any) (defaults to: '2')
  • minute_cronjob (Any) (defaults to: '0')
  • month_cronjob (Any) (defaults to: undef)
  • monthday_cronjob (Any) (defaults to: undef)
  • weekday_cronjob (Any) (defaults to: '6')


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'manifests/maintenance/analyze.pp', line 1

class postgresql::maintenance::analyze (
                                          $ensure  = 'present',
                                          $basedir = '/usr/local/bin',
                                          #cron - by default weekly every saturday
                                          $setcronjob          = true,
                                          $hour_cronjob        = '2',
                                          $minute_cronjob      = '0',
                                          $month_cronjob       = undef,
                                          $monthday_cronjob    = undef,
                                          $weekday_cronjob     = '6',
                                        ) inherits postgresql::params {
  Exec {
    path => '/usr/sbin:/usr/bin:/sbin:/bin',
  }

  file { "${basedir}/analyze.sh":
    ensure  => $ensure,
    owner   => 'root',
    group   => 'root',
    mode    => '0750',
    content => file("${module_name}/vacuum_analyze.sh"),
  }

  if($setcronjob)
  {
    cron { 'cronjob vacuum analyze':
      ensure   => $ensure,
      command  => "${basedir}/analyze.sh",
      user     => 'postgres',
      hour     => $hour_cronjob,
      minute   => $minute_cronjob,
      month    => $month_cronjob,
      monthday => $monthday_cronjob,
      weekday  => $weekday_cronjob,
      require  => File["${basedir}/analyze.sh"],
    }
  }
}