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 #!/bin/bash
# Gravity Sync by vmstan # 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) # 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 # 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}" echo -e "${CYAN}Evaluating $0 script arguments${NC}"
case $# in case $# in
0) 0)
echo -e "${RED}Failure${NC}: ${GRAVITY_FI} replication direction required" echo -e "${RED}Failure${NC}: ${GRAVITY_FI} replication direction required"
echo "Usage: $0 {pull|push}" echo "Usage: $0 {pull|push}"
@ -79,10 +80,10 @@ case $# in
echo -e "No changes have been made to the system" echo -e "No changes have been made to the system"
exit 1 exit 1
;; ;;
1) 1)
case $1 in case $1 in
pull) pull)
echo -e "${GREEN}Success${NC}: Pull Requested" echo -e "${GREEN}Success${NC}: Pull Requested"
echo -e "${CYAN}Copying ${GRAVITY_FI} from remote server ${REMOTE_HOST}${NC}" 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} 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 reloadlists'
ssh ${REMOTE_USER}@${REMOTE_HOST} 'pihole restartdns' ssh ${REMOTE_USER}@${REMOTE_HOST} 'pihole restartdns'
echo -e "${GREEN}gravity.db push completed${NC}" echo -e "${GREEN}gravity.db push completed${NC}"
break;; exit
;;
No ) No )
echo "No changes have been made to the system" echo "No changes have been made to the system"
exit;; exit
;;
esac esac
done done
exit exit
@ -146,10 +150,13 @@ case $# in
case $yn in case $yn in
Yes ) Yes )
git pull git pull
break;; exit
;;
No ) No )
echo "No changes have been made to the system" echo "No changes have been made to the system"
exit;; exit
;;
esac esac
done done
exit exit