Created
August 14, 2018 05:54
-
-
Save stevenharradine/73c01e0ee73038efe247b5a7b5ff7ccd to your computer and use it in GitHub Desktop.
synchronises an adhole server with others via ssh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| settingsHash=`cat /etc/pihole/blacklist.txt /etc/pihole/whitelist.txt | md5sum` | |
| if [ "$settingsHash" == "`cat /home/pi/current-pihole-settings.md5`" ]; then | |
| echo "nothing to see" | |
| else | |
| echo "it changed" | |
| cat /etc/pihole/blacklist.txt /etc/pihole/whitelist.txt | md5sum > current-pihole-settings.md5 | |
| scp /etc/pihole/blacklist.txt /etc/pihole/whitelist.txt [email protected]:~/ | |
| ssh [email protected] "sudo mv blacklist.txt whitelist.txt /etc/pihole/ && sudo service pihole-FTL restart" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment