This commit is contained in:
Michael Stanclift 2020-05-21 21:42:37 -05:00
parent 7e53996df8
commit 8c1c38f962

View File

@ -1,7 +1,7 @@
#!/bin/bash
# Gravity Sync by vmstan
VERSION='1.1.5'
VERSION='1.1.6'
# Must execute from a location in the home folder of the user who own's it (ex: /home/pi/gravity-sync)
# Configure certificate based SSH authentication between the Pihole HA nodes - it does not use passwords
@ -71,6 +71,7 @@ fi
echo -e "${CYAN}Evaluating $0 script arguments${NC}"
case $# in
0)
echo -e "${RED}Failure${NC}: ${GRAVITY_FI} replication direction required"
echo "Usage: $0 {pull|push}"
@ -79,10 +80,10 @@ case $# in
echo -e "No changes have been made to the system"
exit 1
;;
1)
case $1 in
pull)
echo -e "${GREEN}Success${NC}: Pull Requested"
echo -e "${CYAN}Copying ${GRAVITY_FI} from remote server ${REMOTE_HOST}${NC}"
rsync -v --progress -e 'ssh -p 22' ${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI} ~/${LOCAL_FOLDR}/${GRAVITY_FI}
@ -122,10 +123,13 @@ case $# in
ssh ${REMOTE_USER}@${REMOTE_HOST} 'pihole restartdns reloadlists'
ssh ${REMOTE_USER}@${REMOTE_HOST} 'pihole restartdns'
echo -e "${GREEN}gravity.db push completed${NC}"
break;;
exit
;;
No )
echo "No changes have been made to the system"
exit;;
exit
;;
esac
done
exit
@ -146,10 +150,13 @@ case $# in
case $yn in
Yes )
git pull
break;;
exit
;;
No )
echo "No changes have been made to the system"
exit;;
exit
;;
esac
done
exit