extended to be able to sync remotely via ssh, or locally via instance shared storage

This commit is contained in:
Radar231 2021-11-04 09:57:51 -04:00
parent 2c1cc49659
commit 32c77c1ff9
3 changed files with 29 additions and 1 deletions

View File

@ -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

21
pihole-dns-sync_local.sh Executable file
View File

@ -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"