module-mysql/manifests/server/cron/optimize.pp
Gabriel Filion ae2fbce7ac Randomize time of execution for optimize script.
By default, time will be between midnight and 7:00 any day of the week.

The values are currently hard-coded. This can have serious I/O
repercussions on a server with multiple VMs that run mysql since they
will all run their optimizations simultaneously.
2014-03-06 18:46:06 -05:00

26 lines
715 B
Puppet

# optimize mysql databases regurarely
class mysql::server::cron::optimize (
$optimize_hour,
$optimize_minute,
$optimize_day
) {
file { 'mysql_optimize_script':
path => '/usr/local/sbin/optimize_mysql_tables.rb',
source => 'puppet:///modules/mysql/scripts/optimize_tables.rb',
owner => root,
group => 0,
mode => '0700';
}
cron { 'mysql_optimize_cron':
command => '/usr/local/sbin/optimize_mysql_tables.rb',
user => 'root',
minute => $optimize_minute,
hour => $optimize_hour,
weekday => $optimize_day,
require => [ Exec['mysql_set_rootpw'],
File['mysql_root_cnf'],
File['mysql_optimize_script'] ],
}
}