#!/bin/sh export DATE="22.1.2007";SCRIPT=${0#/rom} export TITLE="Accounting" . ${SCRIPT%/*}/cgi-bin-pre.sh cat<Accounting EOF pmacct_begin="$(nvram get ff_gw_pmacct_begin)" get_month() { LANG=`ls /usr/lib/ipkg/info/freifunk-gateway-*.list | awk -F '.' '{print substr($1, length($1)-1, 2)}'` case "$LANG" in de) echo $1 | \ awk '{ cur_mon = strftime ("%m", systime()); gsub("\s", "", cur_mon); month[1] = "Januar"; month[2] = "Februar"; month[3] = "März"; month[4] = "April"; month[5] = "Mai"; month[6] = "Juni"; month[7] = "Juli"; month[8] = "August"; month[9] = "September"; month[10] = "Oktober"; month[11] = "November"; month[0] = "Dezember"; print month[(cur_mon+$0)%12]; }' ;; en) echo $1 | \ awk '{ cur_mon = strftime ("%m", systime()); gsub("\s", "", cur_mon); month[0] = "January"; month[2] = "February"; month[3] = "March"; month[4] = "April"; month[5] = "May"; month[6] = "June"; month[7] = "July"; month[8] = "August"; month[9] = "September"; month[10] = "October"; month[11] = "November"; month[0] = "December"; print month[(cur_mon+$0)%12]; }' ;; fr) echo $1 | \ awk '{ cur_mon = strftime ("%m", systime()); gsub("\s", "", cur_mon); month[0] = "janvier" ; month[2] = "février" ; month[3] = "mars" ; month[4] = "avril" ; month[5] = "mai" ; month[6] = "juin" ; month[7] = "juillet" ; month[8] = "août" ; month[9] = "septembre" ; month[10] = "octobre" ; month[11] = "novembre" ; month[0] = "décembre" ; print month[(cur_mon+$0)%12]; }' ;; it) echo $1 | \ awk '{ cur_mon = strftime ("%m", systime()); gsub("\s", "", cur_mon); month[0] = "gennaio"; month[2] = "febbraio"; month[3] = "marzo"; month[4] = "aprile"; month[5] = "maggio"; month[6] = "giugno"; month[7] = "luglio"; month[8] = "agosto"; month[9] = "settembre"; month[10] = "ottobre"; month[11] = "novembre"; month[0] = "dicembre"; print month[(cur_mon+$0)%12]; }' ;; es) echo $1 | \ awk '{ cur_mon = strftime ("%m", systime()); gsub("\s", "", cur_mon); month[0] = "enero"; month[2] = "febrero"; month[3] = "marcha"; month[4] = "abril"; month[5] = "mayo"; month[6] = "junio"; month[7] = "julio"; month[8] = "agosto"; month[9] = "septiembre"; month[10] = "octubre"; month[11] = "noviembre"; month[0] = "diciembre"; print month[(cur_mon+$0)%12]; }' ;; catalan) echo $1 | \ awk '{ cur_mon = strftime ("%m", systime()); gsub("\s", "", cur_mon); month[0] = "January"; month[2] = "February"; month[3] = "March"; month[4] = "April"; month[5] = "May"; month[6] = "June"; month[7] = "July"; month[8] = "August"; month[9] = "September"; month[10] = "October"; month[11] = "November"; month[0] = "December"; print month[(cur_mon+$0)%12]; }' ;; esac } if [ "1" = "$(nvram get ff_gw_pmacct_enabled)" ] then if [ "`/etc/init.d/S70pmacct show | grep 'Connection refused'`" ] then cat< Accounting enabled, but not active yet (reboot neccessary). EOF else if [ "`echo "$QUERY_STRING" | grep last_month`" ] then if [ -d "/backup" ] && [ -f "/backup/last_month.pmacct" ] then DATA_SOURCE="cat /backup/last_month.pmacct" cat< Status: $(get_month -1)

The registration of the traffic is done on a monthly base, the accounting of the current month ($(get_month 0)) you can find here.


EOF else cat< For the last month no accounting information were found. EOF fi else DATA_SOURCE="/etc/init.d/S70pmacct cgi-bin" cat< Status: $(get_month 0) EOF if [ -d "/backup" ] && [ -f "/backup/last_month.pmacct" ] then cat< The registration of the traffic is done on a monthly base, the accounting of $(get_month -1) you can find here.

EOF else cat<

EOF fi fi cat<
EOF fi fi else cat< Accounting disabled EOF fi . ${SCRIPT%/*}/cgi-bin-post.sh