#!/bin/bash
#                      /usr/local/bin/syncwebalizer
# http://crystalfaeries.net/posix/bin/syncwebalizer
# celeste:crystalfaery 2016-07-03 16:36:25+00:00
# WARNINGS:
#   *   Despite being named for only syncing webalizer logs,
#     * we are also propogating (and DELETING) images and clipart!
#     * we are also propogating kahealani's private data
#     * (hackers relax, it's not available through the webserver,
#	its permissions only allow local file:/// access :-)
#     * KAHEALANI: move the data into ~/documents hierarchy			###################################!
#	(which requires editing some other scripts to be aware)			###################################!
#   *   We propagate image deletes from host this is executed upon...
#     * which can ALSO delete additions made on other hosts!

me="`hostname`"									# on which host am I being executed?
case $me in

faerie)
    for host in pixy fey
    do
	rsync -auvzH $host:/home/www/{webal*,kahealani} /home/www
	rsync -auvzH /home/www/webalizer.$host /home/www/webalizer		# probably dysfunction merge of webalizer logs
	rsync -auvzH /home/www/{webal*,kahealani} $host:/home/www
	rsync -auvzH --delete /home/www/{imgs,openclipart} $host:/home/www	# propogate local deletes: WARNING!
    done
    ;;

fey)
    for host in pixy faerie
    do
	rsync -auvzH $host:/home/www/{webal*,kahealani} /home/www
	rsync -auvzH /home/www/webalizer.$host /home/www/webalizer		# probably dysfunction merge of webalizer logs
	rsync -auvzH /home/www/{webal*,kahealani} $host:/home/www
	rsync -auvzH --delete /home/www/{imgs,openclipart} $host:/home/www	# propogate local deletes: WARNING!
    done
    ;;

pixy)
    for host in faerie fey
    do
	rsync -auvzH $host:/home/www/{webal*,kahealani} /home/www
	rsync -auvzH /home/www/webalizer.$host /home/www/webalizer		# probably dysfunction merge of webalizer logs
	rsync -auvzH /home/www/{webal*,kahealani} $host:/home/www
	rsync -auvzH --delete /home/www/{imgs,openclipart} $host:/home/www	# propogate local deletes: WARNING!
    done
    ;;

*)
	echo "$0 is not written to execute on host: `hostname`" >&2
	exit	-1
    ;;

esac


syntax highlighted by Code2HTML, v. 0.9.1