#!/bin/bash if test $(uname -n) != "CatZilla"; then echo -e "\e[0;38;05;196mERROR: this script should be executed on CatZilla ONLY!!!\e[0m" exit 1 fi SELF_NAME=$(readlink -f $0) USER_NAME=$(whoami) BASE_PATH=`dirname "$SELF_NAME"` PROJECT_PATH=$(echo $BASE_PATH | sed "s/\/home\/$USER_NAME\/public_html\///") USER_IP="${SSH_CLIENT%% *}" USER_PROJECT_PATH="PhpStormProjects/$PROJECT_PATH" REMOTE_PATH="$USER_NAME@$USER_IP:$USER_PROJECT_PATH" echo -e "Do you really want to sync \e[0;38;05;178m\"$BASE_PATH/\"\e[0m to \e[0;38;05;80m\"$REMOTE_PATH\"\e[0m?" read -p ">(Y/N)? " -n 1 echo if [[ ! $REPLY =~ ^[Yy]$ ]] ; then exit 1 fi rsync -avzl --delete --exclude '.idea' --exclude '.svn' $BASE_PATH/ $REMOTE_PATH exit 0