meverest
asked on
shell scripting help
Hi folks,
i have just set up a linux router box (LRP 2.9.8, 2.2.16 kern) that i am using as an IP accounting server.
using ipchains for accounting rules, and samba client to copy the ipchains -L output to a windows NT share. (from there i parse the ipacc file and stuff the data into a database for prosperity ;-)
at the moment i create a set of files on the samba location as just a static name (eg /mnt/traffic/ip_acc) looks something like this:
mkdir /mnt/traffic
smbmount //ntserver/traffic$ /mnt/traffic -o username=user,password=pas s
ipchains -L subnet1 -v -n > /mnt/traffic/subnet1_acc
ipchains -L subnet2 -v -n > /mnt/traffic/subnet2_acc
ipchains -L subnet_etc -v -n > /mnt/traffic/subnet_etc_ac c
umount /mnt/traffic
rmdir /mnt/traffic
but i want to make this more flexible and reliable. what i would like to try to acheive woiuld be to reset the stats each time i write the output, and create a set of files with some identifier of the date and time created.
in other words, what shell script variable do i use to get my output files look like:
subnet1_acc_17_june_2002_1 430
for a file written at 1:30pm today, etc.?
thanks and regards,
Mike.
i have just set up a linux router box (LRP 2.9.8, 2.2.16 kern) that i am using as an IP accounting server.
using ipchains for accounting rules, and samba client to copy the ipchains -L output to a windows NT share. (from there i parse the ipacc file and stuff the data into a database for prosperity ;-)
at the moment i create a set of files on the samba location as just a static name (eg /mnt/traffic/ip_acc) looks something like this:
mkdir /mnt/traffic
smbmount //ntserver/traffic$ /mnt/traffic -o username=user,password=pas
ipchains -L subnet1 -v -n > /mnt/traffic/subnet1_acc
ipchains -L subnet2 -v -n > /mnt/traffic/subnet2_acc
ipchains -L subnet_etc -v -n > /mnt/traffic/subnet_etc_ac
umount /mnt/traffic
rmdir /mnt/traffic
but i want to make this more flexible and reliable. what i would like to try to acheive woiuld be to reset the stats each time i write the output, and create a set of files with some identifier of the date and time created.
in other words, what shell script variable do i use to get my output files look like:
subnet1_acc_17_june_2002_1
for a file written at 1:30pm today, etc.?
thanks and regards,
Mike.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
eeexcellent! thanks :)
ASKER
subnet1_acc_17_june_2002_1
for a file written at 2:30pm today, etc.?
:-}