projects
/
mirror
/
dsa-puppet.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
032c5a5c80911a979095b98609bd0035dde0a3c6
[mirror/dsa-puppet.git]
/
modules
/
buildd
/
files
/
buildd-schroot-aptitude-kill.squeeze
1
#!/bin/bash
2
3
schroots=$(pgrep -x -u 0 schroot -d ',')
4
pgrep -x -u 0 -P "$schroots" aptitude | xargs ps h -o 'pid,vsz,cputime' | while read pid vsz cputime; do
5
mb=$((vsz/1024))
6
[ "$mb" -lt 250 ] && continue
7
hours=${vsz%%:*}
8
nohours=${vsz#*:}
9
mins=${nohours%:*}
10
11
if [ "$hours" -gt 0 ] || [ "$mins" -gt 15 ]; then
12
kill $pid
13
fi
14
done