From 90a9e642e300f8627a613a696dc50d02d859ecb0 Mon Sep 17 00:00:00 2001 From: "Kevin P. Johnson" Date: Thu, 13 Mar 2014 20:42:12 +0000 Subject: [PATCH] ASM #245 logs in caveData need to be purged. Added function to caveUtil, added BASE_LOGDIR in cave.sh and added function call Change-Id: I41e5e11254fc52e49c4668b2797624c599130c67 Former-commit-id: e3a951da78e67860443432ed157165e0e98e931a [formerly b2797a07886bfc764181e66f34ec0d22ed458f70] [formerly e3a951da78e67860443432ed157165e0e98e931a [formerly b2797a07886bfc764181e66f34ec0d22ed458f70] [formerly 4c833d3389afc3be3cf6d78d18d17d0cbfc8af0c [formerly fad7cf2e6661aa0bcc9c37499e0560b708f192f0]]] Former-commit-id: 4c833d3389afc3be3cf6d78d18d17d0cbfc8af0c Former-commit-id: 32b372db4bd3b905abd7fba6d38f1f14469c9ad1 [formerly 17a4229072d8975f9a7d43f88263a0e644be3f14] Former-commit-id: eb12ec9c14286c639ed82f8bf810c5ddc1f20670 --- cave/build/static/linux/cave/cave.sh | 7 ++++++- cave/build/static/linux/cave/caveUtil.sh | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/cave/build/static/linux/cave/cave.sh b/cave/build/static/linux/cave/cave.sh index 7dcd826280..e237b0be79 100644 --- a/cave/build/static/linux/cave/cave.sh +++ b/cave/build/static/linux/cave/cave.sh @@ -191,13 +191,18 @@ then PROGRAM_NAME="cave" fi -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 & + curTime=`date +%Y%m%d_%H%M%S` # At this point fork so that log files can be set up with the process pid and diff --git a/cave/build/static/linux/cave/caveUtil.sh b/cave/build/static/linux/cave/caveUtil.sh index df1dcb049f..8338c90722 100644 --- a/cave/build/static/linux/cave/caveUtil.sh +++ b/cave/build/static/linux/cave/caveUtil.sh @@ -31,7 +31,7 @@ # fixes for INI files with spaces # Feb 20, 2014 #2780 bclement added site type ini file check # -# +# Mar 13 2014 #15348 kjohnson added function to remove logs source /awips2/cave/iniLookup.sh @@ -305,3 +305,21 @@ function logExitStatus() fi fi } + +#Delete old CAVE logs DR 15348 +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 + +} +