summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2015-02-16 14:19:01 +0100
committerHolger Levsen <holger@layer-acht.org>2015-02-16 14:19:01 +0100
commitc9cb868d2dc60d598371c41d6cb0751c08790133 (patch)
treedc3626dc3f51e93b37f914f9df9cb4ca8338ef73 /bin
parentd02837d31ab70df79ea9a5de5909f5aa0efa6285 (diff)
downloadjenkins.debian.net-c9cb868d2dc60d598371c41d6cb0751c08790133.tar.xz
compress all jenkins logs older than 48h
Diffstat (limited to 'bin')
-rwxr-xr-xbin/maintainance.sh24
1 files changed, 17 insertions, 7 deletions
diff --git a/bin/maintainance.sh b/bin/maintainance.sh
index 16e144f9..132d92ee 100755
--- a/bin/maintainance.sh
+++ b/bin/maintainance.sh
@@ -34,22 +34,30 @@ chroot_checks() {
echo "WARNING: should remove directories in /(s)chroots which are older than a month."
}
+compress_old_jenkins_logs() {
+ local COMPRESSED
+ # compress logs to save space
+ COMPRESSED=$(find /var/lib/jenkins/jobs/*/builds/ -maxdepth 2 -mindepth 2 -mtime +1 -name log -exec pigz -9 -v {} \;)
+ if [ ! -z "$COMPRESSED" ] ; then
+ echo "Logs have been compressed:"
+ echo
+ echo "$COMPRESSED"
+ echo
+ fi
+}
+
remove_old_rebootstrap_logs() {
- local OLDSTUFF COMPRESSED
+ local OLDSTUFF
# delete old html logs to save space
OLDSTUFF=$(find /var/lib/jenkins/jobs/rebootstrap_* -maxdepth 3 -mtime +7 -name log_content.html -exec rm -v {} \;)
if [ ! -z "$OLDSTUFF" ] ; then
echo "Old html logs have been deleted:"
+ echo
echo "$OLDSTUFF"
- fi
- COMPRESSED=$(find /var/lib/jenkins/jobs/rebootstrap_* -maxdepth 3 -mindepth 3 -mtime +1 -name log -exec pigz -9 -v {} \;)
- if [ ! -z "$COMPRESSED" ] ; then
- echo "Logs have been compressed:"
- echo "$COMPRESSED"
+ echo
fi
}
-
report_old_directories() {
# find and warn about old temp directories
if [ -z "$3" ] ; then
@@ -60,6 +68,7 @@ report_old_directories() {
fi
if [ ! -z "$OLDSTUFF" ] ; then
echo "Warning: old temp directories found in $REP_RESULTS"
+ echo
echo "$OLDSTUFF"
echo "Please cleanup manually."
echo
@@ -154,6 +163,7 @@ general_maintainance() {
#
if [ -z $1 ] ; then
general_maintainance
+ compress_old_jenkins_logs
report_squid_usage brief
else
case $1 in