#!/bin/ash ### # # FreeWLAN Addons - http://www.freewlan.info # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA # # http://www.gnu.org/copyleft/gpl.html # ### ########## # Uload v1.1(beta) ########## # extend crontab with # * * * * * /bin/uload # create_stat_file () { echo "" >> /tmp/usage$2.txt # restrict files to last 240 lines (= 4 hours) tail -n 240 /tmp/usage$2.txt > /tmp/usage_tmp.txt; chmod go+w /tmp/usage_tmp.txt; mv /tmp/usage_tmp.txt /tmp/usage$2.txt } upt=$(uptime) averages=$(echo $upt | awk -F 'average:' '{print $2}') aload=$(echo $averages |awk '{print $1}' | sed 's!\.!!g' | sed 's!,!!g') bload=$(echo $averages |awk '{print $2}' | sed 's!\.!!g' | sed 's!,!!g') cload=$(echo $averages |awk '{print $3}' | sed 's!\.!!g' | sed 's!,!!g') create_stat_file $aload 'a' create_stat_file $bload 'b' create_stat_file $cload 'c'