|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
script to update the stats
Hi, I am using the below shell script to update the webalizer stats: Code:
#!/bin/bash username='elogic1' domain='abcd.com' path_to_webalizer='/hsphere/shared/bin/webalizer' path_to_logs='/hsphere/local/home/elogic1/logs/abcd.com' output_dir_statistics='/hsphere/local/home/elogic1/abcd.com/webalizer' log_file=`ls $path_to_logs/$domain*|grep -v .gz` cat $log_file|$path_to_webalizer -n $domain -o $output_dir_statistics The above scripts updates the stats for one domain at a time.Let assume, if there are n-number domains under the user "elogic1", how can I effectively use this script to update for all the domains under the user. Last edited by vgersh99; 10-29-2009 at 02:19 PM.. Reason: code tags, please! |
| Sponsored Links | ||
|
|
|
|||
|
How about... Code:
#!/bin/bash username='elogic1' domains='abcd.com efgh.com ijkl.com' path_to_webalizer='/hsphere/shared/bin/webalizer' path_to_logs='/hsphere/local/home/elogic1/logs/abcd.com' output_dir_statistics='/hsphere/local/home/elogic1/abcd.com/webalizer' for domain in $domains do log_file=`ls $path_to_logs/$domain*|grep -v .gz` cat $log_file|$path_to_webalizer -n $domain -o $output_dir_statistics done |
|
|||
|
I think you need to stuff a little bit more into the loop, like e.g.: Code:
#!/bin/bash username=elogic1 domains="abcd.com efgh.com ijkl.com" path_to_webalizer=/hsphere/shared/bin/webalizer for domain in $domains do path_to_logs=/hsphere/local/home/elogic1/logs/$domain output_dir_statistics=$path_to_logs/webalizer log_file=$(ls $path_to_logs/$domain*|grep -v .gz) $path_to_webalizer -n $domain -o $output_dir_statistics $log_file done |
|
|||
|
How, about the below, will this be work:
#!/bin/bash username=elogic1 domains="/home/elogic1/*" path_to_webalizer=/hsphere/shared/bin/webalizer for domain in $domains do path_to_logs=/hsphere/local/home/elogic1/logs/$domain output_dir_statistics=$path_to_logs/webalizer log_file=$(ls $path_to_logs/$domain*|grep -v .gz) $path_to_webalizer -n $domain -o $output_dir_statistics $log_file done |
|
|||
|
Almost. Assuming that /home/elogic1 contains only the names of the domains, you need to cut off the path of the $domain variable: Code:
#!/bin/bash
username=elogic1
domains="/home/elogic1/*"
path_to_webalizer=/hsphere/shared/bin/webalizer
for domain in $domains
do
path_to_logs=/hsphere/local/home/elogic1/logs/${domain##*/}
output_dir_statistics=$path_to_logs/webalizer
log_file=$(ls $path_to_logs/$domain*|grep -v .gz)
$path_to_webalizer -n $domain -o $output_dir_statistics $log_file
done |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Newbie to perl - Help with stats script | ARwebble | Shell Programming and Scripting | 1 | 03-25-2009 04:52 PM |
| script for taking the stats from a file | archana234 | Shell Programming and Scripting | 22 | 03-19-2009 08:36 PM |
| Google Sitemap Update Frequency and Sitemap Stats | Linux Bot | Complex Event Processing RSS News | 0 | 02-02-2009 09:50 PM |
| script to gather weblogic jvm heap size stats | galenw | Shell Programming and Scripting | 2 | 02-07-2008 01:34 PM |
| Shell Script: want to insert values in database when update script runs | ring | Shell Programming and Scripting | 1 | 10-25-2007 04:06 AM |