All pastes #427017 Raw Edit

Something

public text v1 · immutable
·published 2007-04-06 15:28 UTC
rendered paste body
#!/bin/bash

glroot=/srv/glftpd
glconf=$glroot/etc/glftpd.conf
statsections="ISO 0DAY"
topx=200

username=`ls -1 $glroot/ftp-data/users | grep -i ^$1$`
[ "`echo $1 | grep -i nudde`" ] && username="crusher"
if [ "`echo $1 | grep -i crusher`" ]; then printf "\x2D( User \x02$1\x02 not found, try \x02!rank nudde\x02 instead )\n"; exit 0; fi

if [ "$username" ]; then
 sectnum=0
 output="\x2D( \x02$username\x02 )"
 for sectname in $statsections; do
  rawtext=`$glroot/bin/stats -x $topx -r $glconf -u -m -s $sectnum | grep -i $username | tr " " "+"`
  rank=`echo $rawtext | cut -b 2-4 | tr -d "]"`
  files=`echo $rawtext | cut -c 51-58 | tr -d "+MB"`
  mbytes=`echo $rawtext | cut -c 61-67 | tr -d "+MB"`
  let "sectnum=sectnum+1"
  output="$output-( \x02$sectname\x02: \x02$rank\x02 with \x02$mbytes\x02MB in \x02$files\x02 Files )"
 done
 printf "$output\n"
else
 printf "\x2D( No user like \x02$1\x02 found )\n"
fi

exit 0