Skip to content

Instantly share code, notes, and snippets.

@stevenharradine
Created August 14, 2018 05:54
Show Gist options
  • Select an option

  • Save stevenharradine/73c01e0ee73038efe247b5a7b5ff7ccd to your computer and use it in GitHub Desktop.

Select an option

Save stevenharradine/73c01e0ee73038efe247b5a7b5ff7ccd to your computer and use it in GitHub Desktop.
synchronises an adhole server with others via ssh
#!/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