Greetings and Happy NewYear,
I would like to write a script to accomplish a task, and then run it at regular
intervals (I'll start another thread for that). The thing is I know zero about
programming and in process of learning.


I have a stand-alone firewall (mdk9.1) with no X installed, and a wireless
card and my access to the internet is from a access point else where.
I would like to get the info from /proc/net/wireless (on the firewall) like below.
~$ date && cat /proc/net/wireless
So after a while I came up with something like this below
----------------------------------------------------------------------------------------
#! /bin/bash


#Take wireless link readings from /proc/net/wireless and output to
#file wireless_stat

{ date; cat /proc/net/wireless; } >> wireless_stat
------------------------------------------------------------------------------------------
That seems to give me what I want and I like to set it up to run every 5
minutes with cron.hourly (next thread).
Now every 24 hours I would like to take the file wireless_stat and tar/gzip it
up and start a new one like below.
~$ tar -c -z -f wireless_stat1.tar wireless_stat
then run
~$ rm -f wireless_stat; touch wireless_stat;
How would I write a script that it would increment the the archived files
like "logrotate" does? For instance.
~/tmp$ ll
-rw-rw-r-- 1 mike mike 3084 Jan 4 08:44 wireless_stat
-rw-rw-r-- 1 mike mike 359 Jan 3 19:33 wireless_stat1.tar
Then 24 hours later this.
~/tmp$ ll
-rw-rw-r-- 1 mike mike 3084 Jan 4 08:44 wireless_stat
-rw-rw-r-- 1 mike mike 359 Jan 3 19:33 wireless_stat1.tar
-rw-rw-r-- 1 mike mike 359 Jan 3 19:33 wireless_stat2.tar
This where I'm getting stuck would this be a loop? or a statement?
Would it be a (if, while, for,)? I have a book to help, but I'm afraid
my brain is stuck in a (loop) of not understanding and can not
progress... :-)


Any guidance would appreciated,
Mike





Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to