Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
silv3rr committed Jul 12, 2019
1 parent 52197b4 commit 9702abd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ if it doesnt work for you - too bad, it does for me! :p

### You'll need

- linux or freebsd
- a recent version of bash
- pzs-ng (sitewho, sitebot)
- site pre script that logs PRE to glftpd.log (tested with foo-pre)

### Changes

#### Update v1.1 20190712

- small fix if total traffic is 0

#### Update v1.0 20190609

- added options to turn on/off 'always announce' and 'show bwavg'
Expand Down
8 changes: 3 additions & 5 deletions slv-prebw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if [ "$1" == "" ]; then
fi

##########################################################################
# slv-prebw v1.0 20190609 slv
# slv-prebw v1.1 20190712 slv
##########################################################################
# ..based on wspre-bw.sh, from *somewhere* ;)
# + requires a recent version of bash
Expand Down Expand Up @@ -99,7 +99,7 @@ if [ "${bwavg}" -ne "0" ] || [ "${SHOW_ALWAYS}" -eq "1" ]; then
bwavgtext=" \"$(func_cspeed ${bwavg})\""
fi
if [ "${SHOW_TRAF}" -eq "1" ]; then
i=0; traf_total=0; traftext=""
i=0; traftext=""; traf_total=0; u_cnt=0; g_cnt=0
IFS=$'\n'
for line in $( func_tail | grep -v "${PREDIR}" | grep " o " | grep "${release}" | awk '{ print $8, $14, $15 }' ); do
IFS=" " read -r traf uname gname <<< "${line}"
Expand All @@ -110,9 +110,7 @@ if [ "${bwavg}" -ne "0" ] || [ "${SHOW_ALWAYS}" -eq "1" ]; then
done
u_cnt="$( printf "%s\n" "${un_arr[@]}" | func_ugcount )"
g_cnt="$( printf "%s\n" "${gn_arr[@]}" | func_ugcount )"
if [ "${traf_total}" -ne "0" ]; then
traftext=" \"$(func_csize ${traf_total})\" \"${u_cnt}\" \"${g_cnt}\""
fi
traftext=" \"$(func_csize ${traf_total})\" \"${u_cnt}\" \"${g_cnt}\""
fi
if [ "$DEBUG" -eq 1 ]; then echo "DEBUG: traf_total=$traf_total bwavgtext=$bwavgtext"; fi
echo "$( date "+%a %b %d %T %Y" ) PREBW: \"${release}\" ${bwtext/% /}${bwavgtext}${traftext}" >> ${GLLOG}
Expand Down

0 comments on commit 9702abd

Please sign in to comment.