Skip to content

Instantly share code, notes, and snippets.

@oakaigh
Created October 7, 2018 09:40
Show Gist options
  • Save oakaigh/4717bb01d87d703402a05979c0bc87aa to your computer and use it in GitHub Desktop.
Save oakaigh/4717bb01d87d703402a05979c0bc87aa to your computer and use it in GitHub Desktop.
#!/bin/bash
tarAddr="192.168.3.1"
tarAddrSrv="47.100.165.144"
tarAddrSrvFallback="114.114.114.114"
estatePath="/etc/dnsmasq.conf"
ask () {
read -n 1 -p "[1 Remove |2 Restore] eLitex Service: " n
case $n in
1) tarAddrInLang=$tarAddrSrv
dstAddrInLang=$tarAddrSrvFallback;;
2) tarAddrInLang=$tarAddrSrvFallback
dstAddrInLang=$tarAddrSrv;;
*) printf "\n"
exit;;
esac
}
ask
ssh root@$tarAddr "sed -i 's/$tarAddrInLang/$dstAddrInLang/g' $estatePath && killall dnsmasq && /etc/init.d/dnsmasq start"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment