Add cron job to run weekly prune the data set of db

This commit adds a new cron job to the subunit2sql server manifest to
periodically run a data expiration on the subunit2sql db. This will
delete any data in the DB which is over 186 days old which is roughly
6 months. This should enable us to keep 1 releases worth of data in
the DB at a time.

Change-Id: I0e52a1943d75fedfefa8beb2b9f1fcdb406af220
This commit is contained in:
Matthew Treinish 2015-04-22 20:57:10 -04:00
parent 5327cc64a8
commit 78868c6950
1 changed files with 13 additions and 0 deletions

View File

@ -22,6 +22,10 @@ class subunit2sql::server (
$db_host,
$db_port = '3306',
$db_name = 'subunit2sql',
$expire_age = '186',
$expire_cron_minute = '0',
$expire_cron_hour = '3',
$expire_cron_weekday = '7',
) {
file { '/etc/subunit2sql.conf':
@ -56,4 +60,13 @@ class subunit2sql::server (
refreshonly => true,
timeout => 0,
}
cron { 'subunit2sql-prune':
ensure => present,
command => 'subunit2sql-db-manage --config-file /etc/subunit2sql.conf expire --expire-age $expire_age >> /var/log/subunit2sql_migration.log 2>&1 & ',
minute => $expire_cron_minute,
hour => $expire_cron_hour,
weekday => $expire_cron_weekday,
environment => 'PATH=/usr/local/bin:/usr/bin:/bin/',
}
}