forked from rrobinett/wsprdaemon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wd-grape-statistics.sh
executable file
·44 lines (38 loc) · 1.57 KB
/
wd-grape-statistics.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
#!/bin/bash
declare WD_PSWS_SITES=( S000042 S000108 S000109 S000110 S000111 S000113 S000114 S000115 S000116 S000117 S000119 S000120 S000121 S000123)
function print-header() {
if [[ "$1" == "header" ]]; then
printf "Found ${#date_list[@]} dates in ${#WD_PSWS_SITES[@]} WD GRAPE Sites\n"
fi
printf "Date/Site#:"
local site_id
for site_id in ${WD_PSWS_SITES[@]}; do
local site_num="${site_id: -3}"
printf " %s" "${site_num}"
done
printf "\n"
if [[ "$1" != "header" ]]; then
printf "Found ${#date_list[@]} dates in ${#WD_PSWS_SITES[@]} WD GRAPE Sites\n"
fi
}
function wd-statistics() {
local site_home_list=( ${WD_PSWS_SITES[@]/#/..\/} )
local date_list=( $(find ${site_home_list[@]} -mindepth 1 -maxdepth 1 -type d -name 'OBS*' -printf "%f\n" 2> /dev/null | sort -u ) )
print-header "header"
for obs_date in ${date_list[@]}; do
printf "${obs_date:3:10}: "
local site_home
for site_home in ${site_home_list[@]}; do
local dir_size=" "
local obs_date_dir=${site_home}/${obs_date}
if [[ -d ${obs_date_dir} ]]; then
dir_size="$(du -sh ${obs_date_dir} | cut -f 1)"
fi
printf "%4s " "${dir_size}"
#exit 1
done
printf "\n"
done
print-header "foot"
}
wd-statistics