From af359b71b000651812e1ee70638b480502eba0ec Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 5 Apr 2018 22:05:05 +0200 Subject: media-server on odin --- custom/uucp-mediaserver/scripts/queuesize | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 custom/uucp-mediaserver/scripts/queuesize (limited to 'custom/uucp-mediaserver/scripts/queuesize') diff --git a/custom/uucp-mediaserver/scripts/queuesize b/custom/uucp-mediaserver/scripts/queuesize new file mode 100755 index 00000000..3b98ccdb --- /dev/null +++ b/custom/uucp-mediaserver/scripts/queuesize @@ -0,0 +1,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 -- cgit v1.2.3