From 046c6d6e0db35872aecb596aae04c22459b82a47 Mon Sep 17 00:00:00 2001 From: "Ying-Lian.Shi" Date: Wed, 20 Apr 2016 18:13:53 +0000 Subject: [PATCH] ASM #18910 Change CAVE log purging to add check for find commands already running. Change-Id: I84e168aa8cd3049af189aaa83bec32cad24b39c7 Former-commit-id: 05f1cb8e1b83eeb64f5e3cc3b4ec96f92ff2366a --- cave/build/static/linux/cave/caveUtil.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cave/build/static/linux/cave/caveUtil.sh b/cave/build/static/linux/cave/caveUtil.sh index 483e62553e..b1c04a8f74 100644 --- a/cave/build/static/linux/cave/caveUtil.sh +++ b/cave/build/static/linux/cave/caveUtil.sh @@ -40,6 +40,9 @@ # Jul 23, 2015 ASM#13849 D. Friedman Use a unique Eclipse configuration directory # Aug 03, 2015 #4694 dlovely Fixed path for log file cleanup # Sep 16, 2015 #18041 lshi Purge CAVE logs after 30 days instead of 7 +# Apr 20, 2016 #18910 lshi Change CAVE log purging to add check for find commands +# already running +######################## source /awips2/cave/iniLookup.sh RC=$? @@ -383,11 +386,12 @@ function deleteOldCaveLogs() local curDir=$(pwd) local mybox=$(hostname) - echo -e "Cleaning consoleLogs: " - echo -e "find $HOME/$BASE_LOGDIR -type f -name "*.log" -mtime +30 -exec rm {} \;" - - - find "$HOME/$BASE_LOGDIR" -type f -name "*.log" -mtime +30 -exec rm {} \; + pidof /bin/find > /dev/null + if [[ $? -ne 0 ]] ; then + echo -e "Cleaning consoleLogs: " + echo -e "find $HOME/$BASE_LOGDIR -type f -name "*.log" -mtime +30 | xargs rm " + find "$HOME/$BASE_LOGDIR" -type f -name "*.log" -mtime +30 | xargs rm + fi exit 0