#!/bin/bash rsyncConfig() { int=`rsync -au --stats $1 $2 |grep transferred:` echo ${int##*:} } config=`rsyncConfig vmls-haproxy1:/etc/haproxy/ /etc/haproxy` certs=`rsyncConfig vmls-haproxy1:/etc/ssl/certs/companyname/ /etc/ssl/certs/companyname` all=$(( ${config:-0} + ${certs:-0} )) if [[ $all -ne 0 ]] then echo "$all files transferred, reloading HAProxy..." systemctl reload haproxy echo "HAProxy has been reloaded" else echo "$all files transferred, no need to do anything" fi