Last active
August 29, 2015 14:04
-
-
Save tomykaira/113fcbdb720121c8e6e1 to your computer and use it in GitHub Desktop.
Remove RCov *.html files in /builds for Jenkins.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This simple shell script removes intermediate HTML files used by RCov and RubyMetrics plugin. | |
# RubyMetrics plugin extract data from HTML and save them to build.xml, so they are not used after tests are done. | |
# The HTML files are generated per tested file, then its number becomes enormous. | |
# Execute this script by cron or something to clean them up. | |
set -e | |
# Set this variable to the directory you want to cleanup | |
# example: /var/lib/jenkins/jobs/JOB_NAME/builds | |
BUILDS_DIR='' | |
[ -z $BUILDS_DIR ] && echo '$BUILDS_DIR is not set' && exit 1 | |
IFS=" | |
" | |
for old_dir in $(\ls -1Fu "$BUILDS_DIR" | awk -v curdir="$BUILDS_DIR/" 'match($0, "/$"){count++; if (count > 1) { print curdir $0 } }'); do | |
find $old_dir -maxdepth 1 -name "*.html" -delete | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment