/usr/bin/nnusage is in nn 6.7.3-8.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | #!/bin/sh
# Generated by nn release 6.7.3 (NOV) at Jun 24 17:30
VERSION="6.7.3 (NOV)"
AWK="awk"
NOV=true
NNTP=true
ACTIVE=/usr/lib/nn/.nn/ACTIVE
NNTPCACHE=
LOG=null
TMP=${TMPDIR-/var/tmp}
DB=/usr/lib/nn/.nn
BIN=/usr/bin
LIB=/usr/lib/nn
AUTH=false
# ---- end of prefix
# CONFIG file is inserted here
OPT=""
SORTMODE=""
ALL=false
LOOP=true
while $LOOP
do
case "$1" in
-a) OPT="$OPT -a"
ALL=true
shift ;;
-t) SORTMODE="+1nr"
shift ;;
-at) OPT="$OPT -a"
ALL=true
SORTMODE="+1nr"
shift ;;
-*) echo "$0: unknown option: $1"
exit 1
;;
*) LOOP=false
;;
esac
done
if [ -f $DB/acct -a -f $BIN/nnacct ] ; then
if $AUTH ; then
echo "USER USAGE QUOTA LAST_ACTIVE COST/PERIOD POLICY"
else
echo "USER USAGE QUOTA LAST_ACTIVE COST/PERIOD"
fi
$BIN/nnacct -r $OPT $@ | sed -e 1d | sort $SORTMODE
exit
fi
OLDLOG=${LOG}.old
if [ ! -s ${OLDLOG} ]
then
OLDLOG=""
fi
cat $OLDLOG $LOG |
if $ALL
then
grep '^U:'
else
grep "^U:.*(${LOGNAME-$USER})"
fi |
${AWK} '
BEGIN {
any=0
}
NF == 7 {
if (split($7, t, ".") == 2) {
u[$5] += t[1] * 60 + t[2]
if (any == 0) printf("Usage since %s %d, %s\n", $2, $3, $4)
any=1
}
}
END {
if (!any) {
printf("No usage statistics\n")
exit
}
for (n in u) {
name=substr(n, 2, length(n)-3)
printf("%-10.10s%8d.%02d\n", name, u[n]/60, u[n]%60);
}
}' |
sort $SORTMODE
|