Greetings all!
This is my first post. I hope it's in the appropriate section. I have to format 4 years worth of awstats data "static" for a client and then move it to their new server.
I don't want to run the commend to do this 48 times. If possible I would like to use a bash script that uses the folders in a directory so the script knows which year-month to do this for me and which folder to place the output in.
The command I need to run is as follows;
Code:
perl /usr/share/awstats/awstats_buildstaticpages.pl -month=12 -year=2006 -config=domain.org -awstatsprog=/var/www/cgi-bin/awstats/awstats.pl -dir=/root/static_awstats/
In the example above the conversion will be for the 12th month in the year in 2006. The above would place the data in static_awstats. However, for the client to be able to browse this data on the new systen through awstats each year-month must be in it's own folder with the same name. For example I would like the above command to place the data in
Code:
/root/static_awstats/2006-12
Easy enough to do if I manually run the command for every year-month that I need. However I want to automate this using the script I hope to write.
I've already created the folders needed for the timeframe I need to use. So my question is.
Can I use the folders that I have created to run the command in a for loop to get all the pages done.
Example of my static_awstats dir;
Code:
/root/static_awstats
-bash-3.00# ls
2006-12 2007-04 2007-08 2007-12 2008-04 2008-08 2008-12 2009-04 2009-08 2009-12 2010-04 2010-08 2010-12
2007-01 2007-05 2007-09 2008-01 2008-05 2008-09 2009-01 2009-05 2009-09 2010-01 2010-05 2010-09 css
2007-02 2007-06 2007-10 2008-02 2008-06 2008-10 2009-02 2009-06 2009-10 2010-02 2010-06 2010-10 icon
2007-03 2007-07 2007-11 2008-03 2008-07 2008-11 2009-03 2009-07 2009-11 2010-03 2010-07 2010-11
So the script should do the following. Get the names of all the folders, run the command once for each folder it finds inserting the -month=$month -year=$year into the command for each time it's run.
I hope this question makes sense to everyone.
Thanks for any suggestions.