Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
syncing_pihole_bash [2022/01/22 00:24]
warmachine created
syncing_pihole_bash [2022/01/22 00:30] (current)
warmachine
Line 4: Line 4:
  
 You can automate this with cron if you like, but I like to run it manually after any dns updates\\ You can automate this with cron if you like, but I like to run it manually after any dns updates\\
 +
 +You will need 3 files, although 2 are just some ascii art to indicate when the script starts and finishes. paste these into your 3 files (dnsreplicate.sh, banner.txt, and banner2.txt) then run the bash script when you want to copy over your dns records. Also note, your IPs should reflect your two different piholes, in this instance, .30 is my secondary pi, and this script lives on the primary on .33. \\
 +
 +sshpass is a pre-requisite for this setup. if you do not have it, install it with your linux package manager. you may also need to setup some sudo permissions to each server, since the script is basically sshing from one server to the other and copying files.
  
 <code> <code>
 #!/bin/bash #!/bin/bash
 cat banner.txt cat banner.txt
-sshpass -f '/home/warmachine/dnsreppw/pw' scp /etc/dnsmasq.d/05-custom.conf warmachine@192.168.1.30:/etc/dnsmasq.d/05-custom.conf +sshpass -f '/home/yourusername/dnsreppw/pw' scp /etc/dnsmasq.d/05-custom.conf yourusername@192.168.1.30:/etc/dnsmasq.d/05-custom.conf 
-sshpass -f '/home/warmachine/dnsreppw/pw' scp /etc/dnsmasq.d/05-pihole-custom-cname.conf warmachine@192.168.1.30:/etc/dnsmasq.d/05-pihole-custom-cname.conf +sshpass -f '/home/yourusername/dnsreppw/pw' scp /etc/dnsmasq.d/05-pihole-custom-cname.conf yourusername@192.168.1.30:/etc/dnsmasq.d/05-pihole-custom-cname.conf 
-sshpass -f '/home/warmachine/dnsreppw/pw' ssh warmachine@192.168.1.30 'sudo systemctl restart pihole-FTL.service'+sshpass -f '/home/yourusername/dnsreppw/pw' ssh yourusername@192.168.1.30 'sudo systemctl restart pihole-FTL.service'
 echo "." echo "."
 echo "." echo "."
Last modified: le 2022/01/22 00:24