--- /dev/null
+#!/bin/bash
+
+schroots=$(pgrep -x -u 0 schroot -d ',')
+pgrep -x -u 0 -P "$schroots" aptitude | xargs ps h -o 'pid,vsz,cputime' | while read pid vsz cputime; do
+ mb=$((vsz/1024))
+ [ "$mb" -lt 250 ] && continue
+ hours=${vsz%%:*}
+ nohours=${vsz#*:}
+ mins=${nohours%:*}
+
+ if [ "$hours" -gt 0 ] || [ "$mins" -gt 15 ]; then
+ kill $pid
+ fi
+done
source => 'puppet:///modules/buildd/buildd-schroot-aptitude-kill',
mode => '0555',
}
- file { '/etc/cron.d/puppet-buildd-aptitude':
- content => "*/5 * * * * root /usr/local/sbin/buildd-schroot-aptitude-kill\n",
+ } else {
+ file { '/usr/local/sbin/buildd-schroot-aptitude-kill':
+ source => 'puppet:///modules/buildd/buildd-schroot-aptitude-kill.squeeze',
+ mode => '0555',
}
}
+ file { '/etc/cron.d/puppet-buildd-aptitude':
+ content => "*/5 * * * * root /usr/local/sbin/buildd-schroot-aptitude-kill\n",
+ }
}