@@ 9,7 9,7 @@ commands[check]="check [-v] [SUBDOMAIN]\nCheck the status of a sub domain."
commands[list]="list\nShow avaible commands."
commands[help]="help COMMAND\nShow helpful information for a command, see:\n$ $(basename "$0") list"
commands[init]="init [-f]\nInit the configs."
-commands[refresh]="refresh\nRefresh domains and subdomains IP's."
+commands[refresh]="refresh [KEY SECRET]\nRefresh domains and subdomains IP's."
commands[nginxd]="nginxd ARGUMENTS...\nWrapper for nginxd."
commands[update]="update\nUpdate the server, pulling and rebuilding the website."
commands[error]="[ERROR] Command entered DNE, please see:\n$ $(basename "$0") list"
@@ 176,28 176,43 @@ scheck()
fi
}
+# srefresh KEY SECRET
srefresh()
{
local key
local secret
local url # Just temporary.
+ local timeout
+ # curl timeout in seconds
+ timeout=5
url='https://git.sr.ht/~skiqqy/skiqqy.xyz/blob/master/dns.py' # Just temporary
+ [ -n "$1" ] && key="$1"
+ [ -n "$2" ] && secret="$2"
+
if [ -z "$godaddy_key_pm" ]
then
read -rp 'Enter GoDaddy Key: ' key
- else
+ elif [ -z "$key" ]
+ then
key="$(pm show "$godaddy_key_pm")"
fi
if [ -z "$godaddy_secret_pm" ]
then
read -rp 'Enter GoDaddy Secret: ' secret
- else
+ elif [ -z "$secret" ]
+ then
secret="$(pm show "$godaddy_secret_pm")"
fi
- python3 <(curl "$url") -k "$key" -s "$secret" # Just temporary.
+ while ! curl -s --connect-timeout "$timeout" "$url" > /dev/null
+ do
+ printf 'Failed to fetch script, is the internet up?'
+ sleep 60
+ done
+
+ python3 <(curl -s "$url") -k "$key" -s "$secret" # Just temporary.
}
snginxd()