Subject: Re: date stuff
From: Chris Hamilton (chris@digitalalaska.com)
Date: Mon Apr 22 2002 - 11:36:30 AKDT
What I'm trying to do is grab usage data for an interface and stick the data
into a file. This is all in a bash script. I'm working on this so I can
collect usage on an IPCop box. So far I have something that looks like
this.
#!/bin/sh
DTE=`date +%y%m%d`.raw
DTEa=`date +%y%m%d`.stats
ifconfig eth0 > $DTE
grep 'RX bytes' $DTE > $DTEa
rm $DTE -f
exit 0
I'll have this script run once a day.
Thanks James and Arthur for the very useful tips.
From here I want to reformat the $DTEa file so that it clearly displays
usage for RX and TX. Then eventually I want to build a cgi interface that
will display all this stuff through a web browser. I admit it's not the
most elegant thing ever created, but it's a great learning tool for me.
Arthur, I have searched for info on IP accounting with ipchains and
iptables, but the man pages don't say much and Google has too much (but not
enough specifics).
Thanks.
Chris.
----- Original Message -----
From: "Arthur Corliss" <arthur@corlissfamily.org>
To: "Chris Hamilton" <chris@digitalalaska.com>; <aklug@aklug.org>
Sent: Sunday, April 21, 2002 5:10 PM
Subject: Re: date stuff
>
> > I'm trying to create a file that includes the date the file was
> > created as part of the filename. Any suggestions?
>
> How are you creating the file (i.e., in a script, from the shell, etc.)?
If
> you just need to do something from bash, something like:
>
> touch foo-`date +%Y%m%d`.log
>
> would do. In Perl, see 'perldoc -f localtime', and so on. . .
>
> --
>
> --Arthur Corliss
> Bolverk's Lair -- http://arthur.corlissfamily.org/
> Digital Mages -- http://www.digitalmages.com/
> "Live Free or Die, the Only Way to Live" -- NH State Motto
>
>
> ---------
> To unsubscribe, send email to <aklug-request@aklug.org>
> with 'unsubscribe' in the message body.
>
>
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
This archive was generated by hypermail 2a23 : Mon Apr 22 2002 - 11:37:12 AKDT