From 4d824c54ebf1588e7e6981700d6f774967259c7f Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Wed, 8 Jul 2020 20:48:53 -0500 Subject: [PATCH] Check for rsync on remote host --- ADVANCED.md | 2 +- gravity-sync.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ADVANCED.md b/ADVANCED.md index f7bb9d7..6f117b2 100644 --- a/ADVANCED.md +++ b/ADVANCED.md @@ -215,4 +215,4 @@ For those who really love Pi-hole and Gravity Sync. Combining the best of both w 2. The VIPs are managed by the keepalived service on each side and will determine which of two Pi-hole responds. You can make your configuration changes to the active VIP address on either side. 3. Client queries one of the two VIP servers, and the responding Pi-hole does it's thing. -Here we use `./gravity-sync pull` on the secondary Pi-hole at each side, and ofset the update intervals from the main sync. \ No newline at end of file +Here we use `./gravity-sync pull` on the secondary Pi-hole at each side, and off-set the update intervals from the main sync. \ No newline at end of file diff --git a/gravity-sync.sh b/gravity-sync.sh index 59e456b..a50da97 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1013,6 +1013,23 @@ function detect_ssh { fi } +function detect_remotersync { + MESSAGE="Validating RSYNC Installed on ${REMOTE_HOST}" + echo_stat + + REMOTERSYNC=$(${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -i "$HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST} "hash rsync") + + if [ "${REMOTERSYNC}" == "-bash: hash: rsync: not found" + then + echo_fail + MESSAGE="Please install RSYNC on ${REMOTE_HOST}" + echo_info + exit_nochange + else + echo_good + fi +} + ## Error Validation function error_validate { if [ "$?" != "0" ] @@ -1304,6 +1321,8 @@ function config_generate { echo_info validate_os_sshpass + + detect_remotersync exit_withchange }