summaryrefslogtreecommitdiff
path: root/custom/uucp-mediaserver/scripts/queuesize
blob: 3b98ccdb72660d91b61b57537586e45945705935 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!@zsh@/bin/zsh

base=$(basename $0)
suffix=${base##*.}

#sent=$(cat /var/queuesize.$suffix)
#uustat -s $suffix | grep 'Executing recv-media' | sed -r 's/^.*\(sending ([0-9]+) bytes\)/\1/' | awk "BEGIN{s=${sent}}{s+=\$1}END{print s}"

awk 'BEGIN{s=0}{s+=$1}END{print s;}' @queueDir@/${suffix}.queuesize

# typeset -a queued
# queued=()

# ids=$({ uustat -s $suffix | cut -d ' ' -f 1; cut -d ' ' -f 2 /var/queuesize.$suffix } | sort | uniq -d )
# queued=(${(f)ids})

# sum=0

# while read size id; do
#     [[ ${queued[(r)$id]} == ${(q)id} ]] || continue
#     sum=$((sum + size))
# done < /var/queuesize.$suffix

# print $sum