Skip to content

Commit

Permalink
for idaholab#453, allow specifying a maximum gigabytes threshold for …
Browse files Browse the repository at this point in the history
…prune_files.sh
  • Loading branch information
mmguero committed Apr 8, 2024
1 parent 1a69873 commit 8379655
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions shared/bin/prune_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ while true ; do
# check initial disk capacity
USAGE_PCT=$(df -k . | awk '{gsub("%",""); capacity=$5}; END {print capacity}')
USAGE_GB=$(du -sh --block-size=1G . | awk '{print $1}')
# du -sh --block-size=1G ~/download/ | awk '{print $1}'
if ( (( $THRESHOLD_PCT > 0 )) && (( $USAGE_PCT > $THRESHOLD_PCT )) ) || ( (( $MAXSIZE_GB > 0 )) && (( $USAGE_GB > $MAXSIZE_GB )) ); then

# we have exceeded the threshold, see if there is something to prune
Expand Down Expand Up @@ -85,7 +84,7 @@ while true ; do

fi # file was rm'ed
fi # file exists

# exclude files in our Zeek live capture directory
done < <(find . -xdev -mindepth 1 -maxdepth $DEPTH -ignore_readdir_race -type f \( ! -path '*/spool/*' -o -path '*/spool/tmp*' \) -printf '%T@ %s %p\0' 2>/dev/null | sort -zn 2>/dev/null)

if (( $DELETED > 0 )) ; then
Expand Down

0 comments on commit 8379655

Please sign in to comment.