Created
          October 7, 2018 09:40 
        
      - 
      
- 
        Save oakaigh/4717bb01d87d703402a05979c0bc87aa to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/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