#!/bin/ash ##Check if DefaultPassword has been set if grep -q DefaultPassword /etc/ddclient/ddclient.conf; then DefPass=$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' 2>/dev/null /root/DefaultDDNSPasswd echo "The default password in ddns config is now: $DefPass" echo "Please re-run the command to add a domain" exit fi #Get information about the domain read -p "Enter domain to be added to DDNS: " domain read -p "Enter the DDNS username for the domain: " username while true; do read -p "Use default DDNS password Y/N? " yn case $yn in [Yy]* ) password=Default;break;; [Nn]* ) read -p "Enter the DDNS password domain: " -s password;echo ''; break;; * ) echo "Please answer yes or no.";; esac done #Update config if test "$password" = "Default"; then cat <> /etc/ddclient/ddclient.conf #$domain Config login=$username $domain EOF else cat <> /etc/ddclient/ddclient.conf #$domain Config login=$username password='$password' $domain EOF fi #Restart service service ddclient restart