summaryrefslogtreecommitdiff
path: root/custom/uucp-mediaserver/scripts/update-queuesize
blob: db1b3e2aed0ce2286254df5d699567fb0de4f11b (plain)
1
2
3
4
5
6
7
8
9
10
#!@zsh@/bin/zsh

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

uustat -s $suffix | grep 'Executing recv-media' | sed -r 's/^([^ ]+) .*\(sending ([0-9]+) bytes\)/\2 \1/' >> @queueDir@/${suffix}.queuesize
tmpFile=$(mktemp --tmpdir=$HOME)
sort -k 2 @queueDir@/${suffix}.queuesize | uniq -f 1 > "${tmpFile}"
cat "${tmpFile}" >! @queueDir@/${suffix}.queuesize
rm "${tmpFile}"