class buildsystem::scheduler { # until ulri is splitted from main iurt rpm include buildsystem::iurt::packages include buildsystem::iurt::upload include buildsystem::var::scheduler $login = $buildsystem::var::scheduler::login $homedir = $buildsystem::var::scheduler::homedir $logdir = $buildsystem::var::scheduler::logdir buildsystem::sshuser { $login: homedir => $homedir, } file { $logdir: ensure => directory, mode => '0755', owner => $login, } cron { 'dispatch jobs': user => $login, command => "EMI_LOG_FILE=${logdir}/emi.log ULRI_LOG_FILE=${logdir}/ulri.log ulri; EMI_LOG_FILE=${logdir}/emi.log emi", minute => '*', } if ($buildsystem::var::scheduler::clean_uploads_logs_age != 0) { cron { 'clean uploads logs': user => $login, # Delete old upload logs command => sprintf("/usr/bin/find %s/uploads -ignore_readdir_race -xdev -depth -type f -ctime +%d -delete", shellquote($homedir), shellquote($buildsystem::var::scheduler::clean_uploads_logs_age)), hour => '*/4', minute => '51', } cron { 'clean uploads dirs': user => $login, # Remove old empty uploads directories. This will take several # passes (over several weeks) to delete a directory hierarchy # because it is looking at ctime instead of mtime, which resets # every time a file/directory underneath it is deleted. # Directories don't take much space, so this shouldn't be a # real issue. command => sprintf("/usr/bin/find %s/uploads -ignore_readdir_race -mindepth 5 -xdev -depth -type d -ctime +%d -empty -delete", shellquote($homedir), shellquote($buildsystem::var::scheduler::clean_uploads_logs_age)), hour => '*/4', minute => '53', } } if ($buildsystem::var::scheduler::clean_uploads_packages_age != 0) { cron { 'clean uploads packages': user => $login, # Delete old upload RPMs command => sprintf("/usr/bin/find %s/uploads -ignore_readdir_race -xdev -depth -type f -name '*.rpm' -ctime +%d -delete", shellquote($homedir), shellquote($buildsystem::var::scheduler::clean_uploads_packages_age)), hour => '*/4', minute => '52', } } }