rendered paste bodytcl: (change in prespam.tcl)
proc prespam:postcommand:pre {event section line} {
global prespam glroot
set path [split [lindex $line 0] "/"]
set fullpath [lindex $line 0]
set rls_name [lindex $path [expr {[llength $path] - 1}]]
set rls_files [lindex $line 3]
set rls_size [lindex $line 4]
set rls_genre [lindex $line 5]
set rls_section [lindex $line 6]
putlog "SITEPRE: (ADD) $rls_name $rls_section"
putlog "SITEPRE: (INFO) $rls_name $rls_files $rls_size"
prespam:sendbot "DBADD $rls_name $rls_section"
prespam:sendbot "DBINFO $rls_name $rls_files $rls_size"
if {[string match -nocase *$rls_section* $prespam(gn_sects)]} {prespam:sendbot "DBGN $rls_name $rls_genre"}
exec $glroot/bin/wspre-bw.sh $fullpath &
return 1
}
shellscript:
#!/bin/bash
rls=$1
glroot=/srv/glftpd
sleeps="15 15 30 30 30"
###################################
bwtext=".:."; time=0
for slp in $sleeps; do
sleep $slp
bw=0
let "time=time+slp"
for leech in `$glroot/bin/sitewho --raw | grep \"DN\" | grep $rls | cut -d '"' -f 12 | cut -d '.' -f 1`; do
let "bw=bw+leech"
done
bwtext="$bwtext $times: $bwkb/s .:."
done
echo `date "+%a %b %d %T %Y"` PREBW: \"$rls\" \"$bwtext\" \n >> $glroot/ftp-data/logs/glftpd.log