forked from greearb/lanforge-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_large_files.sh
executable file
·61 lines (50 loc) · 1.17 KB
/
check_large_files.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
set -x
set -e
eyedee=`id -u`
if (( eyedee != 0 )); then
echo "Please become root to use this script"
exit 1
fi
# Find core files
core_files=()
cd /
while read F; do
core_files+=("$F")
done < <(ls /core* /home/lanforge/core* 2>/dev/null)
# Find ath10k crash residue
ath10_files=()
while read F; do
ath10_files+=("$F")
done < <(ls /home/lanforge/ath10* 2>/dev/null)
# Find size of /mnt/lf that is not mounted
cd /mnt
usage_mnt=`du -shxc .`
# Find size of /lib/modules
cd /lib/modules
usage_libmod=`du -sh *`
# Find how many kernels are installed
cd /boot
boot_kernels=(`ls init*`)
boot_usage=`du -sh .`
HR="---------------------------------------"
# #
# report sizes here #
# #
if (( ${#core_files[@]} > 0 )); then
echo "Core Files:"
echo "$HR"
printf '%s\n' "${core_files[@]}"
echo "$HR"
fi
echo "Usage of /mnt: $usage_mnt"
echo "Usage of /lib/modules: $usage_libmod"
echo "Boot usage: $boot_usage"
if (( ${#boot_kernels[@]} > 4 )); then
echo "Boot ramdisks:"
echo "$HR"
printf '%s\n' "${boot_kernels[@]}"
echo "$HR"
fi
# delete extra things now #
# remove