shell scripting help
Posted on 2002-06-16
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:
smbmount //ntserver/traffic$ /mnt/traffic -o username=user,password=pass
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_acc
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:
for a file written at 1:30pm today, etc.?
thanks and regards,