Various shell scripts for use on the RTC server. Not your official RTC stuff!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
573 B

#! /bin/bash
# App/Services usage histogram
# Author: samhunter@rawtext.club
# https://git.rawtext.club/samhunter/rtc-shell-scripts
#
PROGNAME="${0##*/}"
VERSION="1.0"
recent++ \
| awk '
function hist(x,m){
return sprintf("%-20s\n", substr("####################",0,int(20*(x/max))))
}
{ a[$3]++
max=a[$3]>max?a[$3]:max
}
END{
for (d in a) {
printf("%3d %15.15s %-20.20s\n",a[d], d,hist(a[d],max))
}
}' \
| sort -k1r,2n
# vim: ts=4 sw=4 expandtab :