#!/bin/bash USER=root SERVER=brain.norganoid.com LIVE_DIR=../var/www/norganoid.at/ DEV_DIR=../var/www/dev.norganoid.at/ CONTENT=content/ ERROR="Error. Please make sure you've indicated correct parameters" if [ $# -eq 0 ] then echo $ERROR; exit 1 elif [ $1 == "dev" ] then DIR=$DEV_DIR elif [ $1 == "live" ] then DIR=$LIVE_DIR else echo $ERROR exit 1 fi if [[ -z $2 ]] then echo "Running App Sync (dry-run)" rsync --dry-run -az --force --delete --progress --exclude-from=.rsyncignore ./ $USER@$SERVER:$DIR; elif [[ $2 == "go" ]] then echo "Running App Sync" rsync -az --force --delete --progress --exclude-from=.rsyncignore ./ $USER@$SERVER:$DIR; elif [[ $2 == "content" ]] then if [[ -z $3 ]] then echo "Fetching Content (dry-run)" rsync --dry-run -azv --force --delete --progress --exclude-from=.rsyncignore $USER@$SERVER:$DIR$CONTENT ./$CONTENT; echo "done" elif [[ $3 == "go" ]] then echo "Fetching Content" rsync -azv --force --delete --progress --exclude-from=.rsyncignore $USER@$SERVER:$DIR$CONTENT ./$CONTENT; echo "done" elif [[ $3 == "up" ]] then if [[ -z $4 ]] then echo "Uploading Content (dry-run)" rsync --dry-run -azv --progress --exclude-from=.rsyncignore ./$CONTENT $USER@$SERVER:$DIR$CONTENT; echo "done" elif [[ $4 == "go" ]] then echo "Uploading Content" rsync -azv --progress --exclude-from=.rsyncignore ./$CONTENT $USER@$SERVER:$DIR$CONTENT; echo "done" fi fi fi