#!/bin/bash
# websites v. 0.3
# Skript zum Synchronisieren von Daten von meinen Websites im Internet.
# Thilo Pfennig 2003-2004
#set -x
echo "wuppen v.0.3"

site=$2
# Wo liegen die Dateien (ein darüberliegendes Verzeichnis)
local_path="$HOME/htdocs/"
# Wo liegen die Dateien auf dem Server?
remote_path="/var/www/docs/"
# Login@servername
username="vinci@alternativ.net"
# Wo liegt rsync ?
RSYNC=/usr/bin/rsync

case "$1" in
	-l ) # list websites
echo "Folgend Domainverzeichnisse existieren:"
ls --color $local_path ;;
	-d ) # download website
if [ -z $2 ] 
 then
  echo "domain name is missing"
  exit $POS_PARAMS_MISSING
fi
OPTIONS="-e ssh -av --exclude '*.xvpics' --exclude 'cache' --exclude 'bestellen'"
$RSYNC $option $OPTIONS  $username:$remote_path/$site/ $local_path$site ;;

	-u ) # update website
OPTIONS="-e ssh -av"
#--exclude-from
#$HOME/.rsync-options/default.exclude $HOME/.rsync-options/$site.exclude --delete-after"
$RSYNC $OPTIONS $local_path$site $username:$remote_path ;;
	-h ) #help 
	echo "wuppen [-option] [website]
-u update
-d download
-l list";;
	* )
	echo "usage: -u -d -l or -h for help"
	;;
esac






exit 0

