diff --git a/README.md b/README.md index 2156c86..6765365 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,13 @@ ## Introduction -This repo contains a simple script used to sync the dns and cname configuration +This repo contains simple scripts used to sync the dns and cname configuration files from a primary pihole server to a secondary pihole server. +* pihole-dns-sync_via-ssh.sh + * runs on the secondary pihole and pulls from the primary via ssh + +* pihole-dns-sync_local.sh + * runs on a host mounting common storage between the two pihole instances (ie, for k8s deployment) + * copies the files from the primary pihole instance storage to the secondary pihole instance storage + diff --git a/pihole-dns-sync_local.sh b/pihole-dns-sync_local.sh new file mode 100755 index 0000000..37d5053 --- /dev/null +++ b/pihole-dns-sync_local.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# base directory path +basepath='/mnt/k8s-storage/pihole' +srcdir='pihole-1' +dstdir='pihole-2' +# declare and populate indexed sync array +syncarray=('etc-pihole/custom.list' 'etc-dnsmasq-d/05-pihole-custom-cname.conf') + +curdate=$(date +%Y%m%d-%H%M%S) + +echo "pihole dns sync run: ${curdate}" + +for i in "${syncarray[@]}" +do + echo "syncing $i" + echo cp ${basepath}/${srcdir}/${i} ${basepath}/${dstdir}/${i} +done + +echo "pihole dns sync run completed" + diff --git a/pihole-dns-sync.sh b/pihole-dns-sync_via-ssh.sh similarity index 100% rename from pihole-dns-sync.sh rename to pihole-dns-sync_via-ssh.sh