Intro

Purpose : synchronize local source code with develop machine.

#!/bin/bash

sync_local_to_remote()
{
    echo "Synchronize local folder ${1} to remote folder ${2} ..."
    local_folder=${1}
    remote_folder=${2}
    remote_host=${3}
    fswatch -o $local_folder | while read f; do rsync --delete -avzhcPe ssh $local_folder $remote_host:$remote_folder; done &
    echo "Done! (PID: $!)"
}

sync_local_to_remote "NetAgent"      "/home/heyongchao/go/src/" "root@10.26.67.194"
sync_local_to_remote "NetController" "/home/heyongchao/go/src/" "root@10.26.67.196"