mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-10-31 18:58:01 +00:00
check_large_files.bash: WIP core files
This commit is contained in:
@@ -225,9 +225,12 @@ clean_old_kernels() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clean_core_files() {
|
clean_core_files() {
|
||||||
note "Cleaning core files WIP"
|
note "Cleaning core files..."
|
||||||
|
if (( ${#core_files[@]} < 1 )); then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
if (( $verbose > 0 )); then
|
if (( $verbose > 0 )); then
|
||||||
printf "%s\n" "${core_files[@]}"
|
printf " %s\n" < <( echo "${core_files[@]}" | sort | uniq )
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,8 +297,8 @@ survey_core_files() {
|
|||||||
cd /
|
cd /
|
||||||
#set -x
|
#set -x
|
||||||
mapfile -t core_files < <(ls /core* /home/lanforge/core* 2>/dev/null) 2>/dev/null
|
mapfile -t core_files < <(ls /core* /home/lanforge/core* 2>/dev/null) 2>/dev/null
|
||||||
if [[ $verbose = 1 ]]; then
|
if [[ $verbose = 1 ]] && (( ${#core_files[@]} > 0 )); then
|
||||||
printf "%s\n" "${core_files[@]}"
|
printf " %s\n" "${core_files[@]}" | head
|
||||||
fi
|
fi
|
||||||
if (( ${#core_files[@]} > 0 )); then
|
if (( ${#core_files[@]} > 0 )); then
|
||||||
totals[c]=$(du -hc "${core_files[@]}" | awk '/total/{print $1}')
|
totals[c]=$(du -hc "${core_files[@]}" | awk '/total/{print $1}')
|
||||||
@@ -407,11 +410,26 @@ disk_usage_report
|
|||||||
if (( ${#core_files[@]} > 0 )); then
|
if (( ${#core_files[@]} > 0 )); then
|
||||||
note "Core Files detected:"
|
note "Core Files detected:"
|
||||||
hr
|
hr
|
||||||
#printf ' %s\n' "${core_files[@]}"
|
filestr=""
|
||||||
for core in "${core_files[@]}"; do
|
declare -A core_groups
|
||||||
file $core
|
set -e
|
||||||
done
|
# note that the long pipe at the bottom of the loop is the best way to get
|
||||||
|
# the system to operate with thousands of core files
|
||||||
|
while read group7; do
|
||||||
|
(( $verbose > 0 )) && echo -n '.'
|
||||||
|
group7="${group7%, *}"
|
||||||
|
group7="#${group7//\'/}"
|
||||||
|
[[ ${core_groups[$group7]+_} != _ ]] && core_groups[$group7]=0
|
||||||
|
core_groups[$group7]=$(( ${core_groups[$group7]} + 1 ))
|
||||||
|
|
||||||
|
done < <(echo "${core_files[@]}" | xargs file | awk -F": " '/execfn:/{print $7}')
|
||||||
|
echo ""
|
||||||
|
echo "These types of core files were found:"
|
||||||
|
while read group; do
|
||||||
|
echo " $group -> ${core_groups[$group]}"
|
||||||
|
done < <(echo "${!core_groups[@]}" | sort )
|
||||||
hr
|
hr
|
||||||
|
set +x
|
||||||
selections+=("c")
|
selections+=("c")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user