#!/bin/bash # SRC=warhol.kc SRCPATH=/home/far/logs DSTFILE=access_log # DSTPATH=/home/sites/logs/far DSTFILE=access_log DSTUSR=sites DSTGRP=sites # RSYNC=/usr/bin/rsync FLAGS="-e ssh --stats" CHOWN=/bin/chown # LOG=/var/log/egsynchttpaccess.log # # get the access log file from the remote machine do_rsync() { message "running rsync of $SRCPATH/$SRCFILE on $SRC to $DSTPATH/$DSTFILE on the local machine" $RSYNC $FLAGS root@$SRC:$SRCPATH/$SRCFILE $DSTPATH/$DSTFILE message "setting permissions appropriately for $DSTUSR:$DSTGRP" $CHOWN $DSTUSR:$DSTGRP $DSTPATH $CHOWN $DSTUSR:$DSTGRP $DSTPATH/$DSTFILE } # # run the awstats program to generate the static pages of statistics AWFLAGS="-config=/etc/egawstats/conf/far.conf -update" BSFLAGS="" do_stats() { } # # function to direct a message... message() { TIMESTAMP=`date '+%Y-%m-%d %H:%M.%S'` echo "$0: $TIMESTAMP $@" >> $LOG } # # insert a blank line into the log and on the console insert_blank() { echo "" >> $LOG } # # # get command line args while test $# -ne 0 ; do case $1 in --config|-c) shift CONF=$1 ;; --help|?|-h) MODE="help" ;; esac shift done MODE="run" if test $MODE == "run" ; then do_rsync else echo "$0, copyright 2005 Egressive Limited, www.egressive.com" echo "" echo "Usage: $0 {-c config | -h}" echo "-c or --config - the configuration file name (full path)" echo "-h or --help - this help message" fi exit 0