diff options
author | Christian König <ckoenig@posteo.de> | 2021-10-12 20:49:36 +0300 |
---|---|---|
committer | Christian König <ckoenig@posteo.de> | 2021-10-12 20:53:59 +0300 |
commit | bc21a7155de841b5f39ce8c3c3aa51a691d25fdf (patch) | |
tree | 305b0ea714c8793f49a542a9c68da31c748fe6e2 /advanced/Scripts/webpage.sh | |
parent | b7bba6a689d135a9de972393fee47a520e6c5406 (diff) |
Add option to not reload
Signed-off-by: Christian König <ckoenig@posteo.de>
Diffstat (limited to 'advanced/Scripts/webpage.sh')
-rwxr-xr-x | advanced/Scripts/webpage.sh | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index b651bed5..f382b4d1 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -709,6 +709,7 @@ AddCustomDNSAddress() { ip="${args[2]}" host="${args[3]}" + reload="${args[4]}" if valid_ip "${ip}" || valid_ip6 "${ip}" ; then echo "${ip} ${host}" >> "${dnscustomfile}" @@ -717,8 +718,10 @@ AddCustomDNSAddress() { exit 1 fi - # Restart dnsmasq to load new custom DNS entries - RestartDNS + # Restart dnsmasq to load new custom DNS entries only if $reload not false + if [[ ! $reload == "false" ]]; then + RestartDNS + fi } RemoveCustomDNSAddress() { @@ -726,11 +729,14 @@ RemoveCustomDNSAddress() { ip="${args[2]}" host="${args[3]}" + reload="${args[4]}" sed -i "/^${ip} ${host}$/d" "${dnscustomfile}" - # Restart dnsmasq to update removed custom DNS entries - RestartDNS + # Restart dnsmasq to load new custom DNS entries only if reload is not false + if [[ ! $reload == "false" ]]; then + RestartDNS + fi } AddCustomCNAMERecord() { @@ -738,6 +744,7 @@ AddCustomCNAMERecord() { domain="${args[2]}" target="${args[3]}" + reload="${args[4]}" validDomain="$(checkDomain "${domain}")" if [[ -n "${validDomain}" ]]; then @@ -752,8 +759,10 @@ AddCustomCNAMERecord() { echo " ${CROSS} Invalid Domain passed!" exit 1 fi - # Restart dnsmasq to load new custom CNAME records - RestartDNS + # Restart dnsmasq to load new custom CNAME records only if reload is not false + if [[ ! $reload == "false" ]]; then + RestartDNS + fi } RemoveCustomCNAMERecord() { @@ -761,11 +770,14 @@ RemoveCustomCNAMERecord() { domain="${args[2]}" target="${args[3]}" + reload="${args[4]}" sed -i "/cname=${domain},${target}$/d" "${dnscustomcnamefile}" - # Restart dnsmasq to update removed custom CNAME records - RestartDNS + # Restart dnsmasq to update removed custom CNAME records only if $reload not false + if [[ ! $reload == "false" ]]; then + RestartDNS + fi } main() { |