From 75dd01d76876bd45436e2fb14c2080b7db27eb83 Mon Sep 17 00:00:00 2001 From: "Kevin P. Johnson" Date: Tue, 14 Jan 2014 21:00:57 +0000 Subject: [PATCH] Issue #245 Change-Id: I7fca90d9f039b46061bb12a28485c92e21c4fd85 Former-commit-id: e776776d797a80b059f00bd78dd0806b7b0f2241 --- cave/build/static/linux/cave/cave.sh | 7 ++++++- cave/build/static/linux/cave/caveUtil.sh | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/cave/build/static/linux/cave/cave.sh b/cave/build/static/linux/cave/cave.sh index 76b97f997e..07ebdd02ba 100644 --- a/cave/build/static/linux/cave/cave.sh +++ b/cave/build/static/linux/cave/cave.sh @@ -109,13 +109,18 @@ else fi hostName=`hostname -s` -LOGDIR=$HOME/caveData/logs/consoleLogs/$hostName/ +BASE_LOGDIR=$HOME/caveData/logs/consoleLogs +LOGDIR=$BASE_LOGDIR/$hostName/ + # make sure directory exists if [ ! -d $LOGDIR ]; then mkdir -p $LOGDIR fi +# delete any old disk caches in the background +deleteOldCaveLogs & + export pid=$$ curTime=`date +%Y%m%d_%H%M%S` diff --git a/cave/build/static/linux/cave/caveUtil.sh b/cave/build/static/linux/cave/caveUtil.sh index f7cda30370..44475018d4 100644 --- a/cave/build/static/linux/cave/caveUtil.sh +++ b/cave/build/static/linux/cave/caveUtil.sh @@ -162,3 +162,19 @@ function deleteOldCaveDiskCaches() cd $curDir } + +function deleteOldCaveLogs() +{ + + local curDir=$(pwd) + local mybox=$(hostname) + + echo -e "Cleaning consoleLogs: " + echo -e "find $BASE_LOGDIR -type f -name "*.log" -mtime +7 -exec rm {} \;" + + + find "$BASE_LOGDIR" -type f -name "*.log" -mtime +7 -exec rm {} \; + + exit 0 + +} \ No newline at end of file